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