use of org.jboss.security.SimpleGroup in project wildfly by wildfly.
the class GuestDelegationLoginModule method getRoleSets.
@Override
protected Group[] getRoleSets() throws LoginException {
Group roles = new SimpleGroup("Roles");
Group callerPrincipal = new SimpleGroup("CallerPrincipal");
Group[] groups = { roles, callerPrincipal };
callerPrincipal.addMember(getIdentity());
return groups;
}
use of org.jboss.security.SimpleGroup in project wildfly by wildfly.
the class JASPICAuthenticationMechanism method updateSubjectRoles.
private void updateSubjectRoles(final org.jboss.security.SecurityContext jbossSct) {
if (jbossSct == null) {
throw UndertowLogger.ROOT_LOGGER.nullParamter("org.jboss.security.SecurityContext");
}
RoleGroup contextRoleGroup = jbossSct.getUtil().getRoles();
if (contextRoleGroup == null) {
return;
}
Collection<Role> contextRoles = contextRoleGroup.getRoles();
if (contextRoles.isEmpty()) {
return;
}
Subject subject = jbossSct.getUtil().getSubject();
Set<Group> groupPrincipals = subject.getPrincipals(Group.class);
Group subjectRoleGroup = null;
for (Group candidate : groupPrincipals) {
if (candidate.getName().equals(ROLES_IDENTIFIER)) {
subjectRoleGroup = candidate;
break;
}
}
if (subjectRoleGroup == null) {
subjectRoleGroup = new SimpleGroup(ROLES_IDENTIFIER);
subject.getPrincipals().add(subjectRoleGroup);
}
for (Role role : contextRoles) {
Principal rolePrincipal = new SimplePrincipal(role.getRoleName());
subjectRoleGroup.addMember(rolePrincipal);
}
}
use of org.jboss.security.SimpleGroup in project wildfly by wildfly.
the class RealmDirectLoginModule method getRoleSets.
@Override
protected Group[] getRoleSets() throws LoginException {
Collection<Principal> principalCol = new HashSet<Principal>();
principalCol.add(new RealmUser(getUsername()));
try {
AuthorizingCallbackHandler callbackHandler = getCallbackHandler();
SubjectUserInfo sui = callbackHandler.createSubjectUserInfo(principalCol);
SimpleGroup sg = new SimpleGroup("Roles");
Set<RealmRole> roles = sui.getSubject().getPrincipals(RealmRole.class);
for (RealmRole current : roles) {
sg.addMember(createIdentity(current.getName()));
}
return new Group[] { sg };
} catch (Exception e) {
throw SecurityLogger.ROOT_LOGGER.failureCallingSecurityRealm(e.getMessage());
}
}
use of org.jboss.security.SimpleGroup in project wildfly by wildfly.
the class RemotingLoginModule method getRoleSets.
@Override
protected Group[] getRoleSets() throws LoginException {
Group roles = new SimpleGroup("Roles");
Group callerPrincipal = new SimpleGroup("CallerPrincipal");
Group[] groups = { roles, callerPrincipal };
callerPrincipal.addMember(getIdentity());
return groups;
}
use of org.jboss.security.SimpleGroup in project wildfly by wildfly.
the class AddRoleLoginModule method getRoleSets.
@Override
protected Group[] getRoleSets() throws LoginException {
Group roles = new SimpleGroup(SecurityConstants.ROLES_IDENTIFIER);
roles.addMember(new SimplePrincipal(role));
return new Group[] { roles };
}
Aggregations