PWResetQuestionModelImpl.java revision 41202e15f589286770cacca433bbee5df379d00b
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 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: PWResetQuestionModelImpl.java,v 1.3 2009/11/18 20:52:18 qcheng Exp $
*
*/
/**
* <code>PWResetQuestionModelImpl</code> defines a set of methods that
* are required by password reset question viewbean.
*/
public class PWResetQuestionModelImpl extends PWResetModelImpl
implements PWResetQuestionModel,Constants {
/**
* Name of the token used to parse data
*/
/**
* Name of password reset service option
*/
private static final String PW_RESET_OPTION =
"iplanet-am-password-reset-option";
/**
* Name of password reset service notification option
*/
private static final String PW_RESET_NOTIFICATION =
"iplanet-am-password-reset-notification";
/**
* Name of password reset bind DN attribute
*/
private static final String PW_RESET_BIND_DN =
"iplanet-am-password-reset-bindDN";
/**
* Name of password reset bind password attribute
*/
private static final String PW_RESET_BIND_PASSWORD =
"iplanet-am-password-reset-bindPasswd";
/**
* Name of user question answer attribute
*/
private static final String PW_RESET_QUESTION_ANSWER =
"iplanet-am-user-password-reset-question-answer";
/**
* Name of password reset question attribute
*/
private static final String PW_RESET_QUESTION =
"iplanet-am-password-reset-question";
/**
* Name of password reset personal question attribute
*/
private static final String PW_RESET_PERSONAL_ANSWER =
"iplanet-am-password-reset-user-personal-question";
/**
* Name of user password attribute
*/
/**
* Name of password reset force reset attribute.
*/
private static final String PASSWORD_RESET_FORCE_RESET =
"iplanet-am-password-reset-force-reset";
/**
* Name of user service force reset attribute.
*/
private static final String USER_PASSWORD_RESET_FORCE_RESET =
"iplanet-am-user-password-reset-force-reset";
/**
* Name of password expiration time attribute.
*/
private static final String PASSWORD_EXPIRATION_TIME_ATTR =
"passwordExpirationTime";
/**
* Name of default question selected constant
*/
private static final int DEFAULT_QUESTION_ON = 1;
/**
* Name of personal question selected constant
*/
private static final int PERSONAL_QUESTION_ON = 3;
/**
* Name of password expiration time value for force reset.
*/
private static final String PASSWORD_EXPIRATION_TIME_VALUE =
"19700101000000Z";
/**
* Constructs a password reset question model object
*
*/
public PWResetQuestionModelImpl() {
super();
}
private boolean isUserAnswersCorrect(
) throws SSOException, IdRepoException {
) {
return false;
}
return false;
}
}
return true;
}
try {
}
} catch (PWResetException e) {
}
return password;
}
/**
* Gets the handler to the plugin object.
*
* @param realm Realm name.
* @param attribute attribute name
* @return handler to the plugin object
*/
try {
obj = c.newInstance();
} catch (ClassNotFoundException e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} catch (SMSException e) {
} catch (SSOException e) {
}
return obj;
}
/**
* Gets the handler to the notify password plugin.
*
* @param realm Realm name.
* @return handler to the notify password plugin
*/
}
return passwordNotify;
}
/**
* 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(
throws PWResetException
{
try {
if (passwordNotify != null) {
} else {
}
} else {
}
} else {
}
}
} catch (SSOException e) {
errorMsg = getErrorString(e);
} catch (IdRepoException e) {
errorMsg = getErrorString(e);
}
throw new PWResetException(errorMsg);
throw new PWResetException(informationMsg);
}
}
/**
* Returns map of secret questions that is displayed in reset page.
*
* @param uuid User Id.
* @param realm Realm name
* @return map of secret question.
*/
if (secretQuestionsMap == null) {
try {
} catch (SSOException e) {
} catch (IdRepoException e) {
}
}
return secretQuestionsMap;
}
throws SSOException, IdRepoException {
if (secretQuestionsMap == null) {
try {
}
}
} catch (SMSException e) {
}
}
return secretQuestionsMap;
}
/**
* Gets the localized string for the question
*
* @param question i8n key for the question
* @return localized string for the question
*/
}
/**
* Sents reset password attempt email to the user.
*
* @param user User object
*/
try {
} catch (SSOException e) {
} catch (IdRepoException e) {
}
}
if (userLocale == null) {
}
}
}
/**
* Gets password reset question title
*
* @param attrValue user attribute value
* @return password reset question title
*/
return MessageFormat.format(
}
/**
* Gets ok button label
*
* @return ok button label
*/
public String getOKBtnLabel() {
return getLocalizedString("ok.button");
}
/**
* Gets previous button label
*
* @return previous button label
*/
public String getPreviousBtnLabel() {
return getLocalizedString("previous.button");
}
/**
* Sets no questions configured message
*/
public void setNoQuestionsInfoMsg() {
}
/**
* Gets secret questions that display in the password reset page.
*
* @param set question and answer set
* @param defaults administrator configured default questions
* @param orgDN DN of organization
* @return secret questions that are displayed in the password reset page
*/
return null;
}
new DecryptAction(value));
if (enabled) {
if (dataStatus == PERSONAL_QUESTION_ON) {
} else if (dataStatus == DEFAULT_QUESTION_ON) {
}
}
} else {
if (dataStatus == DEFAULT_QUESTION_ON) {
}
}
}
}
}
return map;
}
/**
* Returns default administrator configured questions
*
* @param realm Realm name.
* @return default questions
*/
throws SSOException, SMSException {
}
/**
*
* @param orgDN DN of organization
* @return <code>true</code> if the feature is enabled, false otherwise
*/
boolean enabled = false;
try {
} catch (SSOException e) {
} catch (SMSException e) {
}
return enabled;
}
private void changePassword(
throw new PWResetException(errorMsg);
} else {
}
if (forceReset) {
}
}
private void notifyUser(
) {
try {
} catch (PWResetException e) {
passwordResetMsg = e.getMessage();
}
}
/**
* Returns missing answer message .
*
* @return missing answer message.
*/
public String getMissingAnswerMessage() {
return errorMsg;
}
/**
* Returns <code>true</code> if the secret questions are available for a user
*
* @param uuid User Id.
* @param realm Realm name.
* @return <code>true</code> if the questions are available, false otherwise
*/
}
/**
* Returns <code>true</code> if the lockout warning message is to be displayed.
*
* @param pwResetLockout <code>PWResetAccountLockout</code> object
* @param uuid User Id.
* @return <code>true</code> if the lockout warning message is to be displayed
*/
private boolean isLockoutWarning(
) {
boolean warnUser = false;
if (warningCount < 0) {
warnUser = true;
} else if (warningCount > 0) {
warnUser = true;
}
return warnUser;
}
/**
* Returns <code>true</code> if the user is not active or is lockout.
*
* @param uuid User Id.
* @param realm Realm name.
* @return <code>true</code> if the user is active and is not lockout.
*/
return !isUserStatusActive(uuid) ||
}
boolean active = false;
try {
} catch (SSOException e) {
errorMsg = getErrorString(e);
} catch (IdRepoException e) {
errorMsg = getErrorString(e);
}
return active;
}
private void changeUserAttribute(
throws SSOException, IdRepoException
{
}
/**
* Returns <code>true</code> if the password reset service or user's
* force change password on next login is enabled.
*
* @param user User object.
* @param realm Realm name.
* @return <code>true</code> if force reset is enabled.
*/
boolean forceReset = false;
try {
} catch (SSOException e) {
} catch (SMSException e) {
}
if (!forceReset) {
try {
} catch (SSOException e) {
} catch (IdRepoException e) {
}
}
return forceReset;
}
/**
* 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.
*/
try {
} else {
"PWResetQuestionModelImpl.setUserPasswordChangedEntry" +
" Cannot not get admin sso token");
}
} catch (SSOException e) {
"PWResetQuestionModelImpl.setUserPasswordChangedEntry", e);
} catch (IdRepoException e) {
"PWResetQuestionModelImpl.setUserPasswordChangedEntry", e);
}
}
}