Java Code Examples for org.jboss.security.SimpleGroup#addMember()

The following examples show how to use org.jboss.security.SimpleGroup#addMember() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RemoteHostTrustLoginModule.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected Group[] getRoleSets() throws LoginException
{
   SimpleGroup roles = new SimpleGroup("Roles");
   Group[] roleSets = {roles};
   if( roleNames != null )
   {
      String[] tokens = roleNames.split(",");
      for ( String token:tokens )
      {
         String roleName = token != null ? token.trim() : token;
         roles.addMember(new SimplePrincipal(roleName));
      }
   }
   return roleSets;
}
 
Example 2
Source File: IdentityLoginModule.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected Group[] getRoleSets() throws LoginException
{
   SimpleGroup roles = new SimpleGroup("Roles");
   Group[] roleSets = {roles};
   if( roleNames != null )
   {
      StringTokenizer tokenizer = new StringTokenizer(roleNames, ",");
      while( tokenizer.hasMoreTokens() )
      {
         String roleName = tokenizer.nextToken();
         roles.addMember(new SimplePrincipal(roleName));
      }
   }
   return roleSets;
}
 
Example 3
Source File: JWTLoginModule.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Override
public boolean commit() throws LoginException {
    subject.getPrincipals().add(jwtPrincipal);
    SimpleGroup roles = new SimpleGroup("Roles");
    for (String name : jwtPrincipal.getGroups()) {
        roles.addMember(new SimplePrincipal(name));
    }
    subject.getPrincipals().add(roles);
    sharedState.put("JsonWebToken", jwtPrincipal);
    return super.commit();
}
 
Example 4
Source File: JBossWebPrincipalFactory.java    From keycloak with Apache License 2.0 5 votes vote down vote up
protected Group[] getRoleSets(Collection<String> roleSet) {
    SimpleGroup roles = new SimpleGroup("Roles");
    Group[] roleSets = {roles};
    for (String role : roleSet) {
        roles.addMember(new SimplePrincipal(role));
    }
    return roleSets;
}
 
Example 5
Source File: WildflyRequestAuthenticator.java    From keycloak with Apache License 2.0 5 votes vote down vote up
protected Group[] getRoleSets(Collection<String> roleSet) {
    SimpleGroup roles = new SimpleGroup("Roles");
    Group[] roleSets = {roles};
    for (String role : roleSet) {
        roles.addMember(new SimplePrincipal(role));
    }
    return roleSets;
}
 
Example 6
Source File: SecurityInfoHelper.java    From keycloak with Apache License 2.0 5 votes vote down vote up
protected static Group[] getRoleSets(Collection<String> roleSet) {
    SimpleGroup roles = new SimpleGroup("Roles");
    Group[] roleSets = {roles};
    for (String role : roleSet) {
        roles.addMember(new SimplePrincipal(role));
    }
    return roleSets;
}
 
Example 7
Source File: KeycloakLoginModule.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
protected Group[] getRoleSets() throws LoginException {
    //log.info("getRoleSets");
    SimpleGroup roles = new SimpleGroup("Roles");
    Group[] roleSets = {roles};
    for (String role : roleSet) {
        //log.info("   adding role: " + role);
        roles.addMember(new SimplePrincipal(role));
    }
    return roleSets;
}
 
Example 8
Source File: SecurityInfoHelper.java    From keycloak with Apache License 2.0 5 votes vote down vote up
protected static Group[] getRoleSets(Collection<String> roleSet) {
    SimpleGroup roles = new SimpleGroup("Roles");
    Group[] roleSets = {roles};
    for (String role : roleSet) {
        roles.addMember(new SimplePrincipal(role));
    }
    return roleSets;
}