本文整理了Java中org.glassfish.security.common.Group.getName()
方法的一些代码示例,展示了Group.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Group.getName()
方法的具体详情如下:
包路径:org.glassfish.security.common.Group
类名称:Group
方法名:getName
暂无
代码示例来源:origin: org.glassfish.common/common-util
public boolean equals(Object other) {
if(other instanceof Group) {
return getName().equals(((Group)other).getName());
} else {
return false;
}
}
}
代码示例来源:origin: eclipse-ee4j/glassfish
public boolean equals(Object other) {
if(other instanceof Group) {
return getName().equals(((Group)other).getName());
} else {
return false;
}
}
public int hashCode() {
代码示例来源:origin: org.glassfish.main.common/common-util
public boolean equals(Object other) {
if(other instanceof Group) {
return getName().equals(((Group)other).getName());
} else {
return false;
}
}
public int hashCode() {
代码示例来源:origin: org.glassfish.main.common/common-util
public int hashCode() {
return getName().hashCode();
}
}
代码示例来源:origin: eclipse-ee4j/glassfish
public int hashCode() {
return getName().hashCode();
}
}
代码示例来源:origin: org.glassfish.main.connectors/work-management
private Callback handleGroupPrincipalCallbackWithMapping(GroupPrincipalCallback gpc) {
String[] groups = gpc.getGroups();
List<String> asGroupNames = new ArrayList<String>();
for (String groupName : groups) {
Group mappedGroup = (Group) securityMap.get(new Group(groupName));
if (mappedGroup != null) {
if(logger.isLoggable(Level.FINEST)){
logger.finest("got mapped group as [" + groupName + "] for eis-group [" + mappedGroup.getName() + "]");
}
asGroupNames.add(mappedGroup.getName());
}
}
String[] asGroupsString = new String[asGroupNames.size()];
for (int i = 0; i < asGroupNames.size(); i++) {
asGroupsString[i] = asGroupNames.get(i);
}
return new GroupPrincipalCallback(gpc.getSubject(), asGroupsString);
//SecurityContext.setCurrent(new SecurityContext(gpc.getSubject()));
}
代码示例来源:origin: org.glassfish.main.admin/admin-util
private boolean ensureGroupMembership(String user, String realm) {
try {
SecurityContext secContext = SecurityContext.getCurrent();
Set ps = secContext.getPrincipalSet(); //before generics
for (Object principal : ps) {
if (principal instanceof Group) {
Group group = (Group) principal;
if (group.getName().equals(AdminConstants.DOMAIN_ADMIN_GROUP_NAME))
return true;
}
}
ADMSEC_LOGGER.fine("User is not a member of the special admin group");
return false;
} catch(Exception e) {
ADMSEC_LOGGER.log(Level.FINE, "User is not a member of the special admin group: {0}", e);
return false;
}
}
代码示例来源:origin: org.glassfish.common/container-common
private boolean ensureGroupMembership(String user, String realm) {
try {
SecurityContext secContext = SecurityContext.getCurrent();
Set ps = secContext.getPrincipalSet(); //before generics
for (Object principal : ps) {
if (principal instanceof Group) {
Group group = (Group) principal;
if (group.getName().equals(AdminConstants.DOMAIN_ADMIN_GROUP_NAME))
return true;
}
}
logger.fine("User is not the member of the special admin group");
return false;
} catch(Exception e) {
logger.log(Level.FINE, "User is not the member of the special admin group: {0}", e.getMessage());
return false;
}
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* write the descriptor class to a DOM tree and return it
*
* @param parent node for the DOM tree
* @param node name
* @param the descriptor to write
* @return the DOM tree top node
*/
public Node writeDescriptor(Node parent, String nodeName, Group descriptor) {
Element principal = appendChild(parent, nodeName);
setAttribute(principal, RuntimeTagNames.NAME, descriptor.getName());
return principal;
}
}
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* write the descriptor class to a DOM tree and return it
*
* @param parent node for the DOM tree
* @param node name
* @param the descriptor to write
* @return the DOM tree top node
*/
public Node writeDescriptor(Node parent, String nodeName, Group descriptor) {
Element principal = appendChild(parent, nodeName);
setAttribute(principal, RuntimeTagNames.NAME, descriptor.getName());
return principal;
}
}
代码示例来源:origin: org.glassfish.security/security
/** Copy constructor. This is called from the JSR88 implementation.
* This is not stored into the internal rolemapper maps.
*/
public RoleMapper(RoleMapper r) {
this.appName = r.getName();
for (Iterator it = r.getRoles(); it.hasNext();) {
String role = (String) it.next();
// recover groups
Enumeration groups = r.getGroupsAssignedTo(new Role(role));
Set<Group> groupsToRole = new HashSet<Group>();
for (; groups.hasMoreElements();) {
Group gp = (Group) groups.nextElement();
groupsToRole.add(new Group(gp.getName()));
addRoleToPrincipal(gp, role);
}
this.roleToGroup.put(role, groupsToRole);
// recover principles
Enumeration users = r.getUsersAssignedTo(new Role(role));
Set<Principal> usersToRole = new HashSet<Principal>();
for (; users.hasMoreElements();) {
PrincipalImpl gp = (PrincipalImpl) users.nextElement();
usersToRole.add(new PrincipalImpl(gp.getName()));
addRoleToPrincipal(gp, role);
}
this.roleToPrincipal.put(role, usersToRole);
}
}
代码示例来源:origin: org.glassfish.main.security/security-ee
/** Copy constructor. This is called from the JSR88 implementation.
* This is not stored into the internal rolemapper maps.
*/
public RoleMapper(RoleMapper r) {
this.appName = r.getName();
for (Iterator<String> it = r.getRoles(); it.hasNext();) {
String role = it.next();
// recover groups
Enumeration<Group> groups = r.getGroupsAssignedTo(new Role(role));
Set<Group> groupsToRole = new HashSet<Group>();
for (; groups.hasMoreElements();) {
Group gp = groups.nextElement();
groupsToRole.add(new Group(gp.getName()));
addRoleToPrincipal(gp, role);
}
this.roleToGroup.put(role, groupsToRole);
// recover principles
Enumeration<Principal> users = r.getUsersAssignedTo(new Role(role));
Set<Principal> usersToRole = new HashSet<Principal>();
for (; users.hasMoreElements();) {
PrincipalImpl gp = (PrincipalImpl) users.nextElement();
usersToRole.add(new PrincipalImpl(gp.getName()));
addRoleToPrincipal(gp, role);
}
this.roleToPrincipal.put(role, usersToRole);
}
}
内容来源于网络,如有侵权,请联系作者删除!