/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: IdRepoSample.java,v 1.2 2008/06/25 05:41:13 qcheng Exp $
*
*/
/*
* Portions Copyright 2015 ForgeRock AS.
*/
/**
* This class
*
*
* @author
*/
public class IdRepoSample {
public IdRepoSample() {
sampleUtils = new IdRepoSampleUtils();
}
private int printIdRepoMenu() {
currentSubRealms, "subrealms");
" AMIdentityRepository operations\n" +
"\t0: Select (sub)Realm 1: Create Identity\n" +
"\t2: Delete Identity 3: Get Allowed Operations\n" +
"\t6: Return to / realm 7: Exit\n");
}
/*
* 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 () {
try {
} catch (IdRepoException ire) {
"doCurrentRealm:IdRepoException getting AMIdentityRepository" +
} catch (SSOException sse) {
"doCurrentRealm: SSOException getting AMIdentityRepository" +
}
try {
currentSubRealms = (idRepo.searchIdentities(IdType.REALM, "*", new IdSearchControl())).getSearchResults();
} catch (SSOException ssoe) {
"doCurrentRealm: SSOException getting subrealms for '" +
} catch (IdRepoException ire) {
"doCurrentRealm: IdRepoException getting subrealms for '" +
}
currentSubRealms, "subrealms");
}
/*
* start of IdRepo processing. have the starting realm name.
* get an SSOToken, and start processing requests.
*/
private void idRepoProcessing()
{
/*
* get:
* 1. userid (default "amadmin")
* 2. userid password (default "openssoxxx")
* 3. starting realm (default "/")
*/
"'s password", DEF_USERPWD);
// login and get the SSOToken
try {
} catch (SSOException ssoe) {
ssoe.getMessage());
} catch (AuthLoginException ale) {
ale.getMessage());
} catch (Exception e) {
"idRepoProcessing: exception getting SSOToken: " +
e.getMessage());
}
/*
* retrieve some information about the current realm, if
* we can as the userid specified.
*/
int i = -1;
boolean doMore = true;
int ians = -1;
while (doMore) {
i = printIdRepoMenu();
switch (i) {
case 0: // select (sub)realm
new IdRepoSampleSubRealm (currentRealm);
if (nextSubRealm != currentRealm) {
}
break;
case 1: // create identity
new IdRepoSampleCreateId (idRepo);
isci.createAMId();
break;
case 2: // delete identity
new IdRepoSampleDeleteId (idRepo);
isdi.deleteAMId();
break;
case 3: // get allowed id operations
try {
ops, "allowed Identity Operations");
}
} catch (IdRepoException ire) {
"idRepoProcessing:IdRepoException: " +
ire.getMessage());
} catch (SSOException ssoe) {
"idRepoProcessing:SSOException: " +
ssoe.getMessage());
}
break;
case 4: // get supported IdTypes
try {
types, "supported IdTypes");
} catch (IdRepoException ire) {
"idRepoProcessing:IdRepoException: " +
ire.getMessage());
} catch (SSOException ssoe) {
"idRepoProcessing:SSOException: " +
ssoe.getMessage());
}
break;
new IdRepoSampleSearchIds (idRepo);
issi.searchAMIds();
break;
case 6: // return to '/' realm
break;
case 7: // exit
doMore = false;
break;
default:
}
}
try {
} catch (AuthLoginException alexc) {
userSID + "'");
}
"' logged out");
}
}
}