|
Java SDK r12.5 SP 8 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.netegrity.llsdk6.imsapi.utility.PasswordCondition
public class PasswordCondition
Encapsulates information about why a given user password is invalid,
and possibly, what value needs to be changed to make the password valid.
A password condition object contains information about an invalid
password or about the grace period for a password that has expired.
The password condition contains a PasswordMessageType
and possibly, one or more arguments. The arguments that apply, if any, depend upon the
message type. For example, message type LONG
applies to a password that contains too many characters. With this type, call
getArgument(MAXIMUM)
to retrieve the maximum number of
characters that the password is allowed.
To determine whether an error condition applies to a password,
call one of the isPasswordValid()
methods in
ServiceProvider
. If the method
returns false
, an error condition exists, and the output
parameter passwordCondition
is returned with the
password condition object.
When a password error condition occurs, you can throw an
exception with IMSException
, and
you can log the error with Logger
.
Example
The following example tests whether an invalid password error was
caused by having too few punctuation characters in the password.
If so, the following error message is added to an
IMSException
object
specifying the minimum number of punctuation characters that
a password must have:
3033=Password must contain at least {0} punctuations.Here is the code:
IMSException imsx = new IMSException(); . . . if (type == PasswordMessageType.CONTENTS_PUNCTUATION) { int min = passwordCondition.getArgument(MINIMUM); Integer minValue = new Integer(min); Object[] params = {minValue.toString()}; imsx.addUserMessage("3033", params); return; }Note: The {0} in the error message is a way to specify a variable value in the message. The value is supplied in the
params
parameter in the call to addUserMessage()
. For more information,
see IMSException
.
Field Summary | |
---|---|
static int |
DAYS
Specifies a password condition that involves a number of days. |
static int |
MAXIMUM
Specifies a password condition that involves a maximum numbers requirement. |
static int |
MINIMUM
Specifies a password condition that involves a minimum numbers requirement. |
Constructor Summary | |
---|---|
PasswordCondition()
Internal use only. |
|
PasswordCondition(PasswordMessageType pmt)
Internal use only. |
Method Summary | |
---|---|
int |
getArgument(int index)
Retrieves the value of the specified password condition. |
int |
getArgumentCount()
Retrieves the number of arguments for this password condition. |
PasswordMessageType |
getMessage()
Retrieves the message type of this PasswordCondition object. |
void |
setArgument(int index,
int value)
Internal use only. |
void |
setMessage(PasswordMessageType pmt)
Internal use only. |
java.lang.String |
toString()
Internal use only. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MINIMUM
getArgument(MINIMUM)
for a CONTENTS_LETTERS
message
type retrieves the minimum number of letter characters that the password can have.
public static final int MAXIMUM
getArgument(MAXIMUM)
for a REPEATING_CHARS
message
type retrieves the maximum number of repeating characters that the password can have.
public static final int DAYS
getArgument(DAYS)
for a GRACE_DAYS
message
type retrieves the number of days left for the password to be usable.
Constructor Detail |
---|
public PasswordCondition()
public PasswordCondition(PasswordMessageType pmt)
Method Detail |
---|
public void setMessage(PasswordMessageType pmt)
public PasswordMessageType getMessage()
PasswordCondition
object.
public void setArgument(int index, int value)
public int getArgument(int index)
index
- The password condition code (for example, MAXIMUM
,
MINIMUM
, or DAYS
)
for the value you are retrieving.
public int getArgumentCount()
public java.lang.String toString()
toString
in class java.lang.Object
|
Java SDK r12.5 SP 8 06/13/2011 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |