Search in sources :

Example 11 with DelegationManager

use of com.sun.identity.delegation.DelegationManager in project OpenAM by OpenRock.

the class RestPermissionTest method setPermission.

private void setPermission(String permissionName, boolean bAdd) throws Exception {
    DelegationManager mgr = new DelegationManager(adminToken, REALM);
    DelegationPrivilege dp = getDelegationPrivilege(permissionName, mgr.getPrivileges());
    if (dp == null) {
        dp = new DelegationPrivilege(permissionName, Collections.EMPTY_SET, REALM);
    }
    Set<String> subject = dp.getSubjects();
    if (bAdd) {
        subject.add(group.getUniversalId());
    } else {
        subject.remove(group.getUniversalId());
    }
    mgr.addPrivilege(dp);
}
Also used : DelegationPrivilege(com.sun.identity.delegation.DelegationPrivilege) DelegationManager(com.sun.identity.delegation.DelegationManager)

Aggregations

DelegationManager (com.sun.identity.delegation.DelegationManager)11 DelegationException (com.sun.identity.delegation.DelegationException)10 Set (java.util.Set)10 SSOException (com.iplanet.sso.SSOException)9 DelegationPrivilege (com.sun.identity.delegation.DelegationPrivilege)7 Iterator (java.util.Iterator)7 HashSet (java.util.HashSet)6 SSOToken (com.iplanet.sso.SSOToken)4 AMIdentity (com.sun.identity.idm.AMIdentity)4 CLIException (com.sun.identity.cli.CLIException)3 IOutput (com.sun.identity.cli.IOutput)3 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)3 IdType (com.sun.identity.idm.IdType)3 IdRepoException (com.sun.identity.idm.IdRepoException)2 List (java.util.List)2 CaseInsensitiveHashSet (com.sun.identity.common.CaseInsensitiveHashSet)1 DelegationPermission (com.sun.identity.delegation.DelegationPermission)1 AMIdentityRepository (com.sun.identity.idm.AMIdentityRepository)1 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)1