Search in sources :

Example 1 with CollectionUtils.asSet

use of org.forgerock.openam.utils.CollectionUtils.asSet in project OpenAM by OpenRock.

the class AMSetupServlet method createDemoUser.

private static void createDemoUser() throws IdRepoException, SSOException {
    SetupProgress.reportStart("configurator.progress.create.demo.user", null);
    Map<String, Set<String>> attributes = new HashMap<String, Set<String>>();
    attributes.put("sn", CollectionUtils.asSet("demo"));
    attributes.put("cn", CollectionUtils.asSet("demo"));
    attributes.put("userpassword", CollectionUtils.asSet("changeit"));
    attributes.put("inetuserstatus", CollectionUtils.asSet("Active"));
    try {
        AMIdentityRepository amir = new AMIdentityRepository(getAdminSSOToken(), "/");
        amir.createIdentity(IdType.USER, "demo", attributes);
    } catch (IdRepoException e) {
        Debug.getInstance(SetupConstants.DEBUG_NAME).error("AMSetupServlet.createDemoUser", e);
        throw e;
    } catch (SSOException e) {
        Debug.getInstance(SetupConstants.DEBUG_NAME).error("AMSetupServlet.createDemoUser", e);
        throw e;
    }
    SetupProgress.reportEnd("emb.done", null);
}
Also used : Set(java.util.Set) CollectionUtils.asSet(org.forgerock.openam.utils.CollectionUtils.asSet) LicenseSet(org.forgerock.openam.license.LicenseSet) HashSet(java.util.HashSet) HashMap(java.util.HashMap) AMIdentityRepository(com.sun.identity.idm.AMIdentityRepository) IdRepoException(com.sun.identity.idm.IdRepoException) SSOException(com.iplanet.sso.SSOException)

Aggregations

SSOException (com.iplanet.sso.SSOException)1 AMIdentityRepository (com.sun.identity.idm.AMIdentityRepository)1 IdRepoException (com.sun.identity.idm.IdRepoException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 LicenseSet (org.forgerock.openam.license.LicenseSet)1 CollectionUtils.asSet (org.forgerock.openam.utils.CollectionUtils.asSet)1