Search in sources :

Example 11 with DelegationPrivilege

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

the class IdServicesImpl method removeIdentityFromPrivileges.

private void removeIdentityFromPrivileges(String name, IdType type, String amsdkDN, String orgName) {
    SSOToken superAdminToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
    AMIdentity id = new AMIdentity(superAdminToken, name, type, orgName, amsdkDN);
    String uid = id.getUniversalId();
    try {
        DelegationManager mgr = new DelegationManager(superAdminToken, orgName);
        Set privilegeObjects = mgr.getPrivileges();
        for (Iterator i = privilegeObjects.iterator(); i.hasNext(); ) {
            DelegationPrivilege p = (DelegationPrivilege) i.next();
            Set subjects = p.getSubjects();
            if (subjects.contains(uid)) {
                subjects.remove(uid);
                mgr.addPrivilege(p);
            }
        }
    } catch (SSOException ex) {
        DEBUG.warning("IdServicesImpl.removeIdentityFromPrivileges", ex);
    } catch (DelegationException ex) {
        DEBUG.warning("IdServicesImpl.removeIdentityFromPrivileges", ex);
    }
}
Also used : DelegationPrivilege(com.sun.identity.delegation.DelegationPrivilege) SSOToken(com.iplanet.sso.SSOToken) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CaseInsensitiveHashSet(com.sun.identity.common.CaseInsensitiveHashSet) HashSet(java.util.HashSet) DelegationManager(com.sun.identity.delegation.DelegationManager) AMIdentity(com.sun.identity.idm.AMIdentity) Iterator(java.util.Iterator) SSOException(com.iplanet.sso.SSOException) DelegationException(com.sun.identity.delegation.DelegationException)

Aggregations

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