CA Identity Manager
Java SDK r12.5 SP 8

 

com.netegrity.llsdk6.imsapi.utility
Class PasswordCondition

java.lang.Object
  extended by com.netegrity.llsdk6.imsapi.utility.PasswordCondition

public class PasswordCondition
extends java.lang.Object

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.

Since:
IdentityMinder 5.6

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

MINIMUM

public static final int MINIMUM
Specifies a password condition that involves a minimum numbers requirement. For example, calling getArgument(MINIMUM) for a CONTENTS_LETTERS message type retrieves the minimum number of letter characters that the password can have.

See Also:
Constant Field Values

MAXIMUM

public static final int MAXIMUM
Specifies a password condition that involves a maximum numbers requirement. For example, calling getArgument(MAXIMUM) for a REPEATING_CHARS message type retrieves the maximum number of repeating characters that the password can have.

See Also:
Constant Field Values

DAYS

public static final int DAYS
Specifies a password condition that involves a number of days. For example, calling getArgument(DAYS) for a GRACE_DAYS message type retrieves the number of days left for the password to be usable.

See Also:
Constant Field Values
Constructor Detail

PasswordCondition

public PasswordCondition()
Internal use only.


PasswordCondition

public PasswordCondition(PasswordMessageType pmt)
Internal use only.

Method Detail

setMessage

public void setMessage(PasswordMessageType pmt)
Internal use only.


getMessage

public PasswordMessageType getMessage()
Retrieves the message type of this PasswordCondition object.

Returns:
PasswordMessageType The message type.

setArgument

public void setArgument(int index,
                        int value)
Internal use only.


getArgument

public int getArgument(int index)
Retrieves the value of the specified password condition.

Parameters:
index - The password condition code (for example, MAXIMUM, MINIMUM, or DAYS) for the value you are retrieving.
Returns:
The value of the specified password condition.

getArgumentCount

public int getArgumentCount()
Retrieves the number of arguments for this password condition.

Returns:
the number of arguments

toString

public java.lang.String toString()
Internal use only.

Overrides:
toString in class java.lang.Object

CA Identity Manager
Java SDK r12.5 SP 8

06/13/2011

© 2011 CA Technologies, Inc. All rights reserved.