Class PWResetModelImpl
- java.lang.Object
-
- com.sun.identity.password.ui.model.PWResetModelImpl
-
- All Implemented Interfaces:
PWResetModel
- Direct Known Subclasses:
PWResetInvalidURLModelImpl,PWResetQuestionModelImpl,PWResetSuccessModelImpl,PWResetUncaughtExceptionModelImpl,PWResetUserValidationModelImpl
public class PWResetModelImpl extends Object implements PWResetModel
PWResetModelImpldefines the basic and commonly used methods used by view beans.
-
-
Field Summary
Fields Modifier and Type Field Description static DebugdebugDebug objectprotected StringerrorMsgError message stored in the modelprotected StringinformationMsgInfo message stored in the modelprotected ISLocaleContextlocaleContextprotected PWResetAdminLogloggerLogger objectprotected StringpasswordResetMsgReset password message stored in the modelStringpwResetLockoutAttrNameStringpwResetLockoutAttrValueprotected ResourceBundleresBundleResource bundle objectprotected SSOTokenssoTokenSSO token objectstatic StringSTRING_TRUEName for string true valueprotected StringuserIdUser distinguished name-
Fields inherited from interface com.sun.identity.password.ui.model.PWResetModel
ACTIVE, DEFAULT_RB, PW_RESET_SERVICE, USER_SERVICE
-
-
Constructor Summary
Constructors Constructor Description PWResetModelImpl()Creates a base model for password reset.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebugError(String message)Prints a message to the console debug file.voiddebugError(String message, Exception e)Prints a message to the console debug file.voiddebugMessage(String message)Prints a message to the console debug file.voiddebugMessage(String message, Exception e)Prints a message to the console debug file.voiddebugWarning(String message)Prints a message to the console debug file.voiddebugWarning(String message, Exception e)Prints a message to the console debug file.protected StringgetAttributeValue(String realm, String attrName)protected SetgetAttributeValues(String realm, String attrName)StringgetCopyRightText()Returns copyright text.protected SetgetDefaultAttrValues(ServiceSchema schema, String attrName)StringgetErrorMessage()Returns error message.StringgetErrorString(Exception ex)Returns a localized error message from an exception.StringgetErrorTitle()Returns title for error message.static StringgetFirstElement(Set set)Returns the firstStringelement from the given set.StringgetHTMLPageTitle()Returns HTML page titleStringgetInformationMessage()Returns information messageStringgetJavaLogoLabel()Returns label for Java logo.protected StringgetL10NAttributeName(ServiceSchemaManager mgr, String key)Returns localized string of an attribute in a serviceStringgetL10NAttributeName(String serviceName, String key)Returns localized string of an attribute in a service.StringgetLocalizedString(String key)Returns localized string.StringgetMailAttribute(String realm)Returns the name of the mail attribute.intgetPasswordResetFailureLockoutCount()Returns failure lockout count for password reset.longgetPasswordResetFailureLockoutDuration()Returns lockout duration for password reset.intgetPasswordResetFailureLockoutMultiplier()Returns lockout multiplier for password reset.longgetPasswordResetFailureLockoutTime()Returns failure lockout time interval for password reset.StringgetPasswordResetLockoutAttributeName()Returns password reset lockout attribute name.StringgetPasswordResetLockoutAttributeValue()Returns password reset lockout attribute value.StringgetPasswordResetLockoutNotification()Returns lockout notification email address for password reset.intgetPasswordResetLockoutUserWarningCount()Returns lockout warn user count for password reset.StringgetPasswordResetMessage()Returns password reset message.StringgetProductLabel()Returns label for product logo.protected ServiceSchemagetPWResetServiceSchema()Returns service schema.StringgetRootSuffix()Returns root suffix.protected SSOTokengetSSOToken()StringgetSunLogoLabel()Returns label for SUN logo.StringgetUserId()Returns the user distinguished name.ISLocaleContextgetUserLocaleContext()Returns locale of user.protected booleanisAttributeSet(String realm, String attrName)booleanisError()Returnstrueif there is an error while processing request.booleanisPasswordResetEnabled()Returnstrueif the password service is available.booleanisPasswordResetFailureLockoutEnabled()Returns true if the password reset lockout feature is enabled.booleanisUserLockout(String userDN, String orgDN)Returns true if the user is locked out from resetting password.booleanmessageEnabled()Returnstrueif message debugging is enabled.voidpopulateLockoutValues(String orgDN)Populates the password reset lockout attributes for a given organization distinguished name and stored them in the model.voidreadPWResetProfile(String realm)Sets the password reset enabled flag depending what is set in the password service for a given realm.voidsendEmailToUser(String from, String[] to, String subject, String msg, String charset)Sents email to the user(s).voidsetUserDN(String value)Set the user distinguished name.voidsetUserLocale(String localeString)Sets the user locale.booleanwarningEnabled()trueif warning message is enabled.voidwriteLog(String msgId, String userDN)Writes to the log file formatted message.voidwriteLog(String msgId, String msg, String userDN)Writes to the log file formatted message.
-
-
-
Field Detail
-
STRING_TRUE
public static final String STRING_TRUE
Name for string true value- See Also:
- Constant Field Values
-
debug
public static Debug debug
Debug object
-
ssoToken
protected SSOToken ssoToken
SSO token object
-
resBundle
protected ResourceBundle resBundle
Resource bundle object
-
userId
protected String userId
User distinguished name
-
errorMsg
protected String errorMsg
Error message stored in the model
-
informationMsg
protected String informationMsg
Info message stored in the model
-
passwordResetMsg
protected String passwordResetMsg
Reset password message stored in the model
-
logger
protected PWResetAdminLog logger
Logger object
-
localeContext
protected ISLocaleContext localeContext
-
pwResetLockoutAttrName
public String pwResetLockoutAttrName
-
pwResetLockoutAttrValue
public String pwResetLockoutAttrValue
-
-
Method Detail
-
getLocalizedString
public String getLocalizedString(String key)
Returns localized string.- Specified by:
getLocalizedStringin interfacePWResetModel- Parameters:
key- resource string key.- Returns:
- localized string.
-
getUserLocaleContext
public ISLocaleContext getUserLocaleContext()
Returns locale of user.- Returns:
- user's locale.
-
debugError
public void debugError(String message)
Prints a message to the console debug file. The message will only be written if the the debug level is set to Error.- Specified by:
debugErrorin interfacePWResetModel- Parameters:
message- to be sent to the debug file.
-
debugError
public void debugError(String message, Exception e)
Prints a message to the console debug file. The message will only be written if the the debug level is set to Error.- Specified by:
debugErrorin interfacePWResetModel- Parameters:
message- to be printed. If message is null it is ignored.e-printStackTracewill be invoked to print the stack trace.
-
warningEnabled
public boolean warningEnabled()
trueif warning message is enabled.- Specified by:
warningEnabledin interfacePWResetModel- Returns:
trueif warning message is enabled.
-
debugWarning
public void debugWarning(String message)
Prints a message to the console debug file. The message will only be written if the the debug level is set greater than Error.- Specified by:
debugWarningin interfacePWResetModel- Parameters:
message- to be printed. If message is null it is ignored.
-
debugWarning
public void debugWarning(String message, Exception e)
Prints a message to the console debug file. The message will only be written if the the debug level is set greater than Error.- Specified by:
debugWarningin interfacePWResetModel- Parameters:
message- to be printed. If message is null it is ignored.e-printStackTracewill be invoked to print the stack trace.
-
messageEnabled
public boolean messageEnabled()
Returnstrueif message debugging is enabled.- Specified by:
messageEnabledin interfacePWResetModel- Returns:
trueif message debugging is enabled.- See Also:
com.iplanet.am.util.Debug#messageEnabled
-
debugMessage
public void debugMessage(String message)
Prints a message to the console debug file. The message will only be written if the the debug level is set greater than Error.- Specified by:
debugMessagein interfacePWResetModel- Parameters:
message- to be printed. If message is null it is ignored.
-
debugMessage
public void debugMessage(String message, Exception e)
Prints a message to the console debug file. The message will only be written if the the debug level is set greater than Error.- Specified by:
debugMessagein interfacePWResetModel- Parameters:
message- to be printed. If message is null it is ignored.e-printStackTracewill be invoked to print the stack trace.
-
getHTMLPageTitle
public String getHTMLPageTitle()
Returns HTML page title- Specified by:
getHTMLPageTitlein interfacePWResetModel- Returns:
- HTML page title
-
isPasswordResetEnabled
public boolean isPasswordResetEnabled()
Returnstrueif the password service is available.- Specified by:
isPasswordResetEnabledin interfacePWResetModel- Returns:
trueif the password service is available.
-
getUserId
public String getUserId()
Returns the user distinguished name.- Specified by:
getUserIdin interfacePWResetModel- Returns:
- user distinguished name.
-
setUserDN
public void setUserDN(String value)
Set the user distinguished name.- Specified by:
setUserDNin interfacePWResetModel- Parameters:
value- user distinguished name.
-
getErrorTitle
public String getErrorTitle()
Returns title for error message.- Specified by:
getErrorTitlein interfacePWResetModel- Returns:
- title for error message.
-
getErrorMessage
public String getErrorMessage()
Returns error message.- Specified by:
getErrorMessagein interfacePWResetModel- Returns:
- error message.
-
isError
public boolean isError()
Returnstrueif there is an error while processing request.- Specified by:
isErrorin interfacePWResetModel- Returns:
trueif there is an error while processing request.
-
getCopyRightText
public String getCopyRightText()
Returns copyright text.- Specified by:
getCopyRightTextin interfacePWResetModel- Returns:
- copyright text.
-
getPasswordResetMessage
public String getPasswordResetMessage()
Returns password reset message.- Specified by:
getPasswordResetMessagein interfacePWResetModel- Returns:
- password reset message.
-
getErrorString
public String getErrorString(Exception ex)
Returns a localized error message from an exception. If the exception is of typeAMExceptionthe error code and any possible arguments will be extracted from the exception and the message will be generated from the code and arguments. All other exception types will return the message fromException.getMessage.- Specified by:
getErrorStringin interfacePWResetModel- Parameters:
ex- exception- Returns:
- Error message localized to users locale.
-
getRootSuffix
public String getRootSuffix()
Returns root suffix.- Specified by:
getRootSuffixin interfacePWResetModel- Returns:
- root suffix.
-
getPWResetServiceSchema
protected ServiceSchema getPWResetServiceSchema() throws SSOException, SMSException
Returns service schema.- Returns:
- service schema.
- Throws:
SSOExceptionSMSException
-
getL10NAttributeName
protected String getL10NAttributeName(ServiceSchemaManager mgr, String key)
Returns localized string of an attribute in a service- Parameters:
mgr- Service schema manager.key- localization key of the attribute.- Returns:
- localized string of an attribute in a service.
-
getL10NAttributeName
public String getL10NAttributeName(String serviceName, String key)
Returns localized string of an attribute in a service.- Parameters:
serviceName- Name of service.key- Localization key of the attribute.- Returns:
- localized string of an attribute in a service.
-
readPWResetProfile
public void readPWResetProfile(String realm)
Sets the password reset enabled flag depending what is set in the password service for a given realm.- Specified by:
readPWResetProfilein interfacePWResetModel- Parameters:
realm- Realm
-
isAttributeSet
protected boolean isAttributeSet(String realm, String attrName) throws SSOException, SMSException
- Throws:
SSOExceptionSMSException
-
getDefaultAttrValues
protected Set getDefaultAttrValues(ServiceSchema schema, String attrName)
-
getAttributeValue
protected String getAttributeValue(String realm, String attrName) throws SSOException, SMSException
- Throws:
SSOExceptionSMSException
-
getAttributeValues
protected Set getAttributeValues(String realm, String attrName) throws SSOException, SMSException
- Throws:
SSOExceptionSMSException
-
getInformationMessage
public String getInformationMessage()
Returns information message- Specified by:
getInformationMessagein interfacePWResetModel- Returns:
- information message
-
getFirstElement
public static String getFirstElement(Set set)
Returns the firstStringelement from the given set. If the set is empty, or null, an empty string will be returned.- Parameters:
set- where element resides- Returns:
- first String element from the set.
-
writeLog
public void writeLog(String msgId, String userDN)
Writes to the log file formatted message.- Parameters:
msgId- Id of the message to be writtenuserDN- user distinguished name
-
writeLog
public void writeLog(String msgId, String msg, String userDN)
Writes to the log file formatted message.- Parameters:
msgId- Id of the message to be writtenmsg- additional message to be writtenuserDN- user distinguished name
-
isPasswordResetFailureLockoutEnabled
public boolean isPasswordResetFailureLockoutEnabled()
Returns true if the password reset lockout feature is enabled.- Returns:
- true if the password reset lockout feature is enabled.
-
getPasswordResetFailureLockoutDuration
public long getPasswordResetFailureLockoutDuration()
Returns lockout duration for password reset.- Returns:
- lockout duration for password reset
-
getPasswordResetFailureLockoutMultiplier
public int getPasswordResetFailureLockoutMultiplier()
Returns lockout multiplier for password reset.- Returns:
- lockout multiplier for password reset
-
getPasswordResetFailureLockoutTime
public long getPasswordResetFailureLockoutTime()
Returns failure lockout time interval for password reset.- Returns:
- failure duration interval for password reset
-
getPasswordResetFailureLockoutCount
public int getPasswordResetFailureLockoutCount()
Returns failure lockout count for password reset.- Returns:
- failure lockout count for password reset
-
getPasswordResetLockoutNotification
public String getPasswordResetLockoutNotification()
Returns lockout notification email address for password reset.- Returns:
- lockout notification email address for password reset
-
getPasswordResetLockoutUserWarningCount
public int getPasswordResetLockoutUserWarningCount()
Returns lockout warn user count for password reset.- Returns:
- lockout warn user count for password reset
-
populateLockoutValues
public void populateLockoutValues(String orgDN)
Populates the password reset lockout attributes for a given organization distinguished name and stored them in the model.- Parameters:
orgDN- organization distinguished name
-
isUserLockout
public boolean isUserLockout(String userDN, String orgDN)
Returns true if the user is locked out from resetting password.- Specified by:
isUserLockoutin interfacePWResetModel- Parameters:
userDN- user distinguished nameorgDN- organization distinguished name- Returns:
- true if the user is locked out
-
sendEmailToUser
public void sendEmailToUser(String from, String[] to, String subject, String msg, String charset)
Sents email to the user(s).- Parameters:
from- sender email addressto- user to which email is send tosubject- email subjectmsg- email messagecharset- charset value
-
getPasswordResetLockoutAttributeName
public String getPasswordResetLockoutAttributeName()
Returns password reset lockout attribute name.- Returns:
- password reset lockout attribute name
-
getPasswordResetLockoutAttributeValue
public String getPasswordResetLockoutAttributeValue()
Returns password reset lockout attribute value.- Returns:
- password reset lockout attribute value
-
getSunLogoLabel
public String getSunLogoLabel()
Returns label for SUN logo.- Specified by:
getSunLogoLabelin interfacePWResetModel- Returns:
- label for SUN logo.
-
getProductLabel
public String getProductLabel()
Returns label for product logo.- Specified by:
getProductLabelin interfacePWResetModel- Returns:
- label for product logo.
-
getJavaLogoLabel
public String getJavaLogoLabel()
Returns label for Java logo.- Specified by:
getJavaLogoLabelin interfacePWResetModel- Returns:
- label for Java logo.
-
getSSOToken
protected SSOToken getSSOToken()
-
setUserLocale
public void setUserLocale(String localeString)
Sets the user locale.- Specified by:
setUserLocalein interfacePWResetModel- Parameters:
localeString- localeString.
-
getMailAttribute
public String getMailAttribute(String realm)
Returns the name of the mail attribute.- Specified by:
getMailAttributein interfacePWResetModel- Parameters:
realm- The realm the user belongs to.- Returns:
- The name of the mail attribute in the provided realm.
-
-