|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.passwordrules.standard.RuleSet
The RuleSet class represents a set of password rules. A RuleSet can be used to generate a random password that conforms to all password rules in the set. The RuleSet can also be used to test a given password for conformity to all rules present in the RuleSet. Additional rules may be added to the RuleSet using the join method. Note, that since RuleSet is a specialization of Rule, another RuleSet can be added to a this RuleSet.
Field Summary | |
---|---|
static int |
ITERATION_LIMIT
This constant is the hardcoded value for the maximum number of times during which a valid password is expected to be randomly generated by the standard generator. |
Constructor Summary | |
---|---|
RuleSet(PasswordRulesInfo rulesInfo)
Constructor accepting PasswordRulesInfo parameter |
Method Summary | |
---|---|
void |
constrain(PasswordGenerator generator)
This Rule interface method in is not valid in the context of this class |
java.lang.String |
generate()
Generate a random password compatible with all rules known to this object. |
int |
getLastIterationCount()
Used for testing only. |
java.lang.String |
getParameter()
This Rule interface method in is not valid in the context of this class |
java.util.Collection |
getRules()
Return all rules contained in this RuleSet object. |
PasswordRulesInfo |
getRulesInfo()
Get PasswordRulesInfo object associated with this RuleSet object. |
ValidationInfo |
getValidationInfo()
Get ValidationInfo object containing the context of the validation. |
boolean |
join(Rule rule)
Join given rule object with this RuleSet object. |
void |
join(RuleSet ruleSet)
Join two RuleSet objects together. |
static RuleSet |
loadFromXML(java.io.InputStream is)
Generate a RuleSet object from the XML representation |
static void |
saveToXML(RuleSet ruleSet,
java.io.OutputStream os,
java.lang.String title)
Generate an XML representation from the given RuleSet object. |
void |
setParameter(java.lang.String parameter)
This Rule interface method in is not valid in the context of this class |
void |
setRulesInfo(PasswordRulesInfo rulesInfo)
Add rules from the given PasswordRulesInfo object on this RuleSet object. |
void |
setValidationInfo(ValidationInfo validationInfo)
Set ValidationInfo object containing the context of the validation. |
boolean |
validate(java.lang.String password,
ValidationInfo validationInfo)
Validate the given password using the given validation info. |
boolean |
validateSafe(java.lang.String password,
ValidationInfo validationInfo)
Validate the given password using the given validation info. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ITERATION_LIMIT
Constructor Detail |
public RuleSet(PasswordRulesInfo rulesInfo)
rulesInfo
- PasswordRulesInfo value object containing the password rules.Method Detail |
public static RuleSet loadFromXML(java.io.InputStream is) throws java.lang.Exception
is
- InputStream to read the XML document from
java.lang.Exception
- if any error occurs during XML processing.public static void saveToXML(RuleSet ruleSet, java.io.OutputStream os, java.lang.String title) throws java.lang.Exception
ruleSet
- RuleSet object t ocovnert to XMLos
- OutputStream to write XML document totitle
- of the XML document
java.lang.Exception
- Any exception thrown when converting ruleSet to XML.public void setRulesInfo(PasswordRulesInfo rulesInfo)
rulesInfo
- PasswordRulesInfo value object containing the password rules.public PasswordRulesInfo getRulesInfo()
public ValidationInfo getValidationInfo()
public void setValidationInfo(ValidationInfo validationInfo)
validationInfo
- ValidationInfo objectpublic java.util.Collection getRules()
public void join(RuleSet ruleSet) throws IncompatibleRulesException
ruleSet
- RuleSet to join
IncompatibleRulesException
- when RuleSet object to join contains incompatible rules.public boolean join(Rule rule) throws IncompatibleRulesException
join
in interface Rule
rule
- Rule object to join
IncompatibleRulesException
- when the Rule object to join contains an incompatible rule.public boolean validate(java.lang.String password, ValidationInfo validationInfo) throws InvalidPasswordException
validate
in interface Rule
validationInfo
- ValidationInfo objectpassword
- Password to validate.
InvalidPasswordException
- Thrown when given password violates one of the rules.public java.lang.String generate() throws IterationsExceededException
IterationsExceededException
- when a maximum number of iterations allowed before generating a valid
password is exceeded.ITERATION_LIMIT
public boolean validateSafe(java.lang.String password, ValidationInfo validationInfo)
validateSafe
in interface Rule
password
- Password to validate.validationInfo
- ValidationInfo object
public void constrain(PasswordGenerator generator)
constrain
in interface Rule
generator
- PasswordGenerator object to be constrained.public java.lang.String getParameter()
getParameter
in interface Rule
java.lang.RuntimeException
- alwayspublic void setParameter(java.lang.String parameter)
setParameter
in interface Rule
parameter
-
java.lang.RuntimeException
- alwayspublic int getLastIterationCount()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |