Search in sources :

Example 16 with SimpleGroup

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 };
}
Also used : SimpleGroup(org.jboss.security.SimpleGroup) Group(java.security.acl.Group) SimpleGroup(org.jboss.security.SimpleGroup) SimplePrincipal(org.jboss.security.SimplePrincipal)

Example 17 with SimpleGroup

use of org.jboss.security.SimpleGroup in project wildfly by wildfly.

the class CustomLoginModule method getRoleSets.

/**
     * Returns Roles and CallerPrincipal groups. The Roles group contains role defined as login module option. The
     * CallerPrincipal contains {@link CustomPrincipal} instance with fixed name {@value #CALLER_NAME}.
     *
     * @return
     * @throws LoginException
     * @see org.jboss.security.auth.spi.AbstractServerLoginModule#getRoleSets()
     */
@Override
protected Group[] getRoleSets() throws LoginException {
    try {
        Group roles = new SimpleGroup(SecurityConstants.ROLES_IDENTIFIER);
        roles.addMember(new SimplePrincipal(role));
        Group callerPrincipal = new SimpleGroup(SecurityConstants.CALLER_PRINCIPAL_GROUP);
        callerPrincipal.addMember(new CustomPrincipal(CALLER_NAME));
        return new Group[] { roles, callerPrincipal };
    } catch (Exception e) {
        throw new LoginException(e.toString());
    }
}
Also used : SimpleGroup(org.jboss.security.SimpleGroup) Group(java.security.acl.Group) SimpleGroup(org.jboss.security.SimpleGroup) LoginException(javax.security.auth.login.LoginException) SimplePrincipal(org.jboss.security.SimplePrincipal) LoginException(javax.security.auth.login.LoginException)

Example 18 with SimpleGroup

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;
}
Also used : SimpleGroup(org.jboss.security.SimpleGroup) Group(java.security.acl.Group) SimpleGroup(org.jboss.security.SimpleGroup)

Example 19 with SimpleGroup

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());
    }
}
Also used : SimpleGroup(org.jboss.security.SimpleGroup) Group(java.security.acl.Group) RealmRole(org.jboss.as.core.security.RealmRole) RealmUser(org.jboss.as.core.security.RealmUser) SimpleGroup(org.jboss.security.SimpleGroup) AuthorizingCallbackHandler(org.jboss.as.domain.management.AuthorizingCallbackHandler) SubjectUserInfo(org.jboss.as.core.security.SubjectUserInfo) Principal(java.security.Principal) LoginException(javax.security.auth.login.LoginException) UnsupportedCallbackException(javax.security.auth.callback.UnsupportedCallbackException) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) HashSet(java.util.HashSet)

Example 20 with SimpleGroup

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;
}
Also used : SimpleGroup(org.jboss.security.SimpleGroup) Group(java.security.acl.Group) SimpleGroup(org.jboss.security.SimpleGroup)

Aggregations

SimpleGroup (org.jboss.security.SimpleGroup)25 Group (java.security.acl.Group)22 SimplePrincipal (org.jboss.security.SimplePrincipal)21 Principal (java.security.Principal)12 NestableGroup (org.jboss.security.NestableGroup)12 Subject (javax.security.auth.Subject)5 RoleGroup (org.jboss.security.identity.RoleGroup)4 SimpleRoleGroup (org.jboss.security.identity.plugins.SimpleRoleGroup)4 LoginException (javax.security.auth.login.LoginException)2 GenericPrincipal (org.apache.catalina.realm.GenericPrincipal)2 JBossGenericPrincipal (org.jboss.as.web.security.JBossGenericPrincipal)2 IOException (java.io.IOException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 UnsupportedCallbackException (javax.security.auth.callback.UnsupportedCallbackException)1 RealmRole (org.jboss.as.core.security.RealmRole)1 RealmUser (org.jboss.as.core.security.RealmUser)1 SubjectUserInfo (org.jboss.as.core.security.SubjectUserInfo)1 AuthorizingCallbackHandler (org.jboss.as.domain.management.AuthorizingCallbackHandler)1