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);
}
}
Aggregations