use of com.sun.identity.idm.AMIdentityRepository in project OpenAM by OpenRock.
the class IdRepoSample method doCurrentRealm.
/*
* for the current Realm, get:
* 1. its AMIdentityRepository object
* 2. its AMIdentity (via getRealmIdentity())
* 3. realm for the AMIdentity (via getRealm())
* 4. name for the AMIdentity (via getName())
* 5. its subrealms (via
* OrganizationConfigManager.getSubOrganizationNames())
*/
private void doCurrentRealm() {
String currentAMIdName = null;
String currentRealmAMIdName = null;
try {
idRepo = new AMIdentityRepository(ssoToken, currentRealm);
AMIdentity currentRealmAMId = idRepo.getRealmIdentity();
currentRealmAMIdName = currentRealmAMId.getRealm();
currentAMIdName = currentRealmAMId.getName();
} catch (IdRepoException ire) {
System.err.println("doCurrentRealm:IdRepoException getting AMIdentityRepository" + " object for '" + currentRealm + "': " + ire.getMessage());
System.exit(7);
} catch (SSOException sse) {
System.err.println("doCurrentRealm: SSOException getting AMIdentityRepository" + " object for '" + currentRealm + "': " + sse.getMessage());
System.exit(8);
}
System.out.println("AMIdentity realm name for realm '" + currentRealm + "' is '" + currentRealmAMIdName + "'");
System.out.println("getting subrealms");
try {
currentSubRealms = (idRepo.searchIdentities(IdType.REALM, "*", new IdSearchControl())).getSearchResults();
} catch (SSOException ssoe) {
System.err.println("doCurrentRealm: SSOException getting subrealms for '" + currentRealm + "': " + ssoe.getMessage());
} catch (IdRepoException ire) {
System.err.println("doCurrentRealm: IdRepoException getting subrealms for '" + currentRealm + "': " + ire.getMessage());
}
sampleUtils.printResultsRealm("Realm '" + currentRealm + "'", currentSubRealms, "subrealms");
}
use of com.sun.identity.idm.AMIdentityRepository in project OpenAM by OpenRock.
the class ApplicationPrivilegeCLITest method cleanup.
@AfterClass
public void cleanup() throws Exception {
AMIdentityRepository amir = new AMIdentityRepository(adminToken, "/");
Set<AMIdentity> identities = new HashSet<AMIdentity>();
identities.add(user1);
identities.add(user2);
amir.deleteIdentities(identities);
}
use of com.sun.identity.idm.AMIdentityRepository in project OpenAM by OpenRock.
the class IdRepoTest method deleteDummyGroup.
private void deleteDummyGroup(String realm) throws IdRepoException, SSOException {
SSOToken adminSSOToken = getAdminSSOToken();
AMIdentityRepository amir = new AMIdentityRepository(adminSSOToken, realm);
AMIdentity amid = new AMIdentity(adminSSOToken, DUMMY_GROUP, IdType.GROUP, realm, null);
Set<AMIdentity> set = new HashSet<AMIdentity>(2);
set.add(amid);
amir.deleteIdentities(set);
}
use of com.sun.identity.idm.AMIdentityRepository in project OpenAM by OpenRock.
the class PrivilegeUtilsTest method deleteUsers.
private void deleteUsers(SSOToken adminToken, String... names) throws IdRepoException, SSOException {
AMIdentityRepository amir = new AMIdentityRepository(adminToken, "/");
Set identities = new HashSet();
for (String name : names) {
String uuid = "id=" + name + ",ou=user," + ServiceManager.getBaseDN();
identities.add(IdUtils.getIdentity(adminToken, uuid));
}
amir.deleteIdentities(identities);
}
use of com.sun.identity.idm.AMIdentityRepository in project OpenAM by OpenRock.
the class ProxyPETest method cleanup.
@AfterClass
public void cleanup() throws PolicyException, SSOException, IdRepoException {
try {
lc.logout();
} catch (Exception e) {
//ignore
}
SSOToken adminToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
PolicyManager pm = new PolicyManager(adminToken, "/");
pm.removePolicy(POLICY_NAME1);
AMIdentityRepository amir = new AMIdentityRepository(adminToken, "/");
Set<AMIdentity> identities = new HashSet<AMIdentity>();
identities.add(testUser);
//amir.deleteIdentities(identities);
}
Aggregations