Example usage for java.security.acl Group members

List of usage examples for java.security.acl Group members

Introduction

In this page you can find the example usage for java.security.acl Group members.

Prototype

public Enumeration<? extends Principal> members();

Source Link

Document

Returns an enumeration of the members in the group.

Usage

From source file:org.nuxeo.ecm.platform.login.NuxeoAbstractServerLoginModule.java

public boolean commit() throws LoginException {
    log.trace("commit, loginOk=" + loginOk);
    if (!loginOk) {
        return false;
    }//from   w  w  w  . j  a v  a2s  .c  o m

    Set<Principal> principals = subject.getPrincipals();
    Principal identity = getIdentity();
    principals.add(identity);
    Group[] roleSets = getRoleSets();
    for (Group group : roleSets) {
        String name = group.getName();
        Group subjectGroup = createGroup(name, principals);

        /*
         * if( subjectGroup instanceof NestableGroup ) { SimpleGroup tmp = new SimpleGroup("Roles");
         * subjectGroup.addMember(tmp); subjectGroup = tmp; }
         */

        // Copy the group members to the Subject group
        Enumeration<? extends Principal> members = group.members();
        while (members.hasMoreElements()) {
            Principal role = members.nextElement();
            subjectGroup.addMember(role);
        }
    }
    return true;
}