Search in sources :

Example 1 with IdRepoException

use of com.sun.identity.idm.IdRepoException in project OpenAM by OpenRock.

the class PWResetQuestionModelImpl method setUserPasswordChangedEntry.

/**
     * Sets the password expiration time attribute value to special value 
     * which will force the user to change their password when they login 
     * into admin console. It will use admin's sso token to write the value 
     * for this attribute.
     *
     * @param uuid User Id.
     * @param password Password of the user.
     */
private void setUserPasswordChangedEntry(String uuid, String password) {
    try {
        SSOToken token = getSSOToken();
        if (token != null) {
            ssoToken = token;
            AMIdentity user = IdUtils.getIdentity(token, uuid);
            changeUserAttribute(user, PASSWORD_EXPIRATION_TIME_ATTR, PASSWORD_EXPIRATION_TIME_VALUE);
        } else {
            debug.error("PWResetQuestionModelImpl.setUserPasswordChangedEntry" + " Cannot not get admin sso token");
        }
    } catch (SSOException e) {
        debug.error("PWResetQuestionModelImpl.setUserPasswordChangedEntry", e);
    } catch (IdRepoException e) {
        debug.error("PWResetQuestionModelImpl.setUserPasswordChangedEntry", e);
    }
}
Also used : SSOToken(com.iplanet.sso.SSOToken) AMIdentity(com.sun.identity.idm.AMIdentity) IdRepoException(com.sun.identity.idm.IdRepoException) SSOException(com.iplanet.sso.SSOException)

Example 2 with IdRepoException

use of com.sun.identity.idm.IdRepoException in project OpenAM by OpenRock.

the class PWResetQuestionModelImpl method isUserStatusActive.

private boolean isUserStatusActive(String uuid) {
    boolean active = false;
    try {
        AMIdentity user = IdUtils.getIdentity(getSSOToken(), uuid);
        active = user.isActive();
    } catch (SSOException e) {
        debug.warning("PWResetQuestionModelImpl.isUserStatusActive", e);
        errorMsg = getErrorString(e);
    } catch (IdRepoException e) {
        debug.warning("PWResetQuestionModelImpl.isUserStatusActive", e);
        errorMsg = getErrorString(e);
    }
    return active;
}
Also used : AMIdentity(com.sun.identity.idm.AMIdentity) IdRepoException(com.sun.identity.idm.IdRepoException) SSOException(com.iplanet.sso.SSOException)

Example 3 with IdRepoException

use of com.sun.identity.idm.IdRepoException in project OpenAM by OpenRock.

the class PWResetQuestionModelImpl method resetPassword.

/**
     * Resets the user password.
     *
     * @param uuid User Id.
     * @param realm Realm name.
     * @param map  map of user question and answer
     * @throws PWResetException if unable to reset the password
     */
public void resetPassword(String uuid, String realm, Map map) throws PWResetException {
    populateLockoutValues(realm);
    PWResetAccountLockout pwResetLockout = new PWResetAccountLockout(this);
    try {
        localeContext.setOrgLocale(realm);
        AMIdentity user = IdUtils.getIdentity(getSSOToken(), uuid);
        sendAttemptEmail(user);
        if (isUserAnswersCorrect(map, user, realm)) {
            pwResetLockout.removeUserLockoutEntry(uuid);
            String password = getPasswordResetValue(realm, user);
            if (password != null && password.length() > 0) {
                NotifyPassword passwordNotify = getNotifyPassword(realm);
                if (passwordNotify != null) {
                    changePassword(user, password, passwordNotify, uuid, realm);
                    writeLog("pwResetSuccess.message", uuid);
                } else {
                    errorMsg = getLocalizedString("passResetError.message");
                }
            } else {
                errorMsg = getLocalizedString("passResetError.message");
            }
        } else {
            pwResetLockout.invalidAnswer(user);
            if (!isLockoutWarning(pwResetLockout, uuid)) {
                errorMsg = getLocalizedString("wrongAnswer.message");
            }
        }
    } catch (SSOException e) {
        debug.warning("PWResetQuestionModelImpl.resetPassword", e);
        errorMsg = getErrorString(e);
    } catch (IdRepoException e) {
        debug.warning("PWResetQuestionModelImpl.resetPassword", e);
        errorMsg = getErrorString(e);
    }
    if ((errorMsg != null) && (errorMsg.length() > 0)) {
        writeLog("pwResetFail.message", errorMsg, uuid);
        throw new PWResetException(errorMsg);
    } else if ((informationMsg != null) && (informationMsg.length() > 0)) {
        writeLog("pwResetFail.message", uuid);
        throw new PWResetException(informationMsg);
    }
}
Also used : AMIdentity(com.sun.identity.idm.AMIdentity) IdRepoException(com.sun.identity.idm.IdRepoException) SSOException(com.iplanet.sso.SSOException) NotifyPassword(com.sun.identity.password.plugins.NotifyPassword)

Example 4 with IdRepoException

use of com.sun.identity.idm.IdRepoException in project OpenAM by OpenRock.

the class AgentsModelImpl method createAgentGroup.

/**
     * Creates agent group.
     *
     * @param realmName Realm where agent group resides.
     * @param name Name of agent group.
     * @param type Type of agent group.
     * @throws AMConsoleException if agent group cannot be created.
     */
public void createAgentGroup(String realmName, String name, String type) throws AMConsoleException {
    String[] params = { realmName, name, type };
    try {
        logEvent("ATTEMPT_CREATE_AGENT_GROUP", params);
        AgentConfiguration.createAgentGroup(getUserSSOToken(), realmName, name, type, AgentConfiguration.getDefaultValues(type, true));
        logEvent("SUCCEED_CREATE_AGENT_GROUP", params);
    } catch (ConfigurationException e) {
        String[] paramsEx = { realmName, name, type, getErrorString(e) };
        logEvent("EXCEPTION_CREATE_AGENT_GROUP", paramsEx);
        debug.warning("AgentsModelImpl.createAgentGroup", e);
        throw new AMConsoleException(getErrorString(e));
    } catch (SSOException e) {
        String[] paramsEx = { realmName, name, type, getErrorString(e) };
        logEvent("EXCEPTION_CREATE_AGENT_GROUP", paramsEx);
        debug.warning("AgentsModelImpl.createAgentGroup", e);
        throw new AMConsoleException(getErrorString(e));
    } catch (IdRepoException e) {
        String[] paramsEx = { realmName, name, type, getErrorString(e) };
        logEvent("EXCEPTION_CREATE_AGENT_GROUP", paramsEx);
        debug.warning("AgentsModelImpl.createAgentGroup", e);
        throw new AMConsoleException(getErrorString(e));
    } catch (SMSException e) {
        String[] paramsEx = { realmName, name, type, getErrorString(e) };
        logEvent("EXCEPTION_CREATE_AGENT_GROUP", paramsEx);
        debug.warning("AgentsModelImpl.createAgentGroup", e);
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : ConfigurationException(com.sun.identity.common.configuration.ConfigurationException) SMSException(com.sun.identity.sm.SMSException) IdRepoException(com.sun.identity.idm.IdRepoException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 5 with IdRepoException

use of com.sun.identity.idm.IdRepoException in project OpenAM by OpenRock.

the class OpenSSOGroupSubject method getSubjectAttributesManager.

private SubjectAttributesManager getSubjectAttributesManager() {
    String uuid = getID();
    if (uuid == null) {
        return null;
    }
    try {
        AMIdentity amid = new AMIdentity(null, uuid);
        String realm = amid.getRealm();
        SSOToken adminToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
        return SubjectAttributesManager.getInstance(SubjectUtils.createSubject(adminToken), realm);
    } catch (IdRepoException idex) {
        if (PrivilegeManager.debug.messageEnabled()) {
            PrivilegeManager.debug.message("OpenSSOGroupSubject.getSubjectAttributesManager:", idex);
        }
    }
    return null;
}
Also used : SSOToken(com.iplanet.sso.SSOToken) AMIdentity(com.sun.identity.idm.AMIdentity) IdRepoException(com.sun.identity.idm.IdRepoException)

Aggregations

IdRepoException (com.sun.identity.idm.IdRepoException)403 SSOException (com.iplanet.sso.SSOException)275 Set (java.util.Set)224 AMIdentity (com.sun.identity.idm.AMIdentity)221 HashSet (java.util.HashSet)183 Map (java.util.Map)121 Iterator (java.util.Iterator)118 SSOToken (com.iplanet.sso.SSOToken)112 HashMap (java.util.HashMap)110 SMSException (com.sun.identity.sm.SMSException)103 AMIdentityRepository (com.sun.identity.idm.AMIdentityRepository)96 CaseInsensitiveHashSet (com.sun.identity.common.CaseInsensitiveHashSet)67 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)58 IdType (com.sun.identity.idm.IdType)57 CaseInsensitiveHashMap (com.sun.identity.common.CaseInsensitiveHashMap)51 CLIException (com.sun.identity.cli.CLIException)48 IOutput (com.sun.identity.cli.IOutput)45 IdSearchResults (com.sun.identity.idm.IdSearchResults)44 IdSearchControl (com.sun.identity.idm.IdSearchControl)39 IdRepoUnsupportedOpException (com.sun.identity.idm.IdRepoUnsupportedOpException)35