|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.passwordrules.standard.RuleSet
The RuleSet class represents a set of related password rules. A RuleSet can be used to generate a random password that conforms to all the password rules in the set. The RuleSet can also be used to test a given password for conformity to all the rules in the RuleSet. Additional rules can be added to the RuleSet using the join method. An note that since RuleSet is a specialization of Rule, and entire RuleSet can be added to a given RuleSet. When adding rules, if the new rule conflicts with the existing rules in the set, an exception is thrown.
Field Summary | |
static int |
ITERATION_LIMIT
This number was 200 when only standard rules were used. |
Constructor Summary | |
RuleSet(PasswordRulesInfo rulesInfo)
Constructor |
Method Summary | |
void |
constrain(PasswordGenerator generator)
This Rule interface method in is not valid in the context of this class |
java.lang.String |
generate()
Generates a randomly created password compatible with the contained rules. |
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()
Method will return all rules contained in this ruleSet objects. |
PasswordRulesInfo |
getRulesInfo()
Getter for PasswordRulesInfo object |
ValidationInfo |
getValidationInfo()
Getter for ValidationInfo object. |
boolean |
join(Rule rule)
Method joins given rule object to this RuleSet object. |
void |
join(RuleSet ruleSet)
Joins two rule sets together. |
static RuleSet |
loadFromXML(java.io.InputStream is)
Method will generate a ruleSet object from XML representation |
static void |
saveToXML(RuleSet ruleSet,
java.io.OutputStream os,
java.lang.String title)
Method will generate XML representation from a give 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)
Setter for PasswordRulesInfo object |
void |
setValidationInfo(ValidationInfo validationInfo)
Setter for ValidationInfo object |
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
- Value object containing the password rulesMethod Detail |
public static RuleSet loadFromXML(java.io.InputStream is) throws java.lang.Exception
is
- InputStreamjava.lang.Exception
- any exception thrown during parsing.public static void saveToXML(RuleSet ruleSet, java.io.OutputStream os, java.lang.String title) throws java.lang.Exception
ruleSet
- RuleSet objectos
- OutputStream to write totitle
- of the XML documentjava.lang.Exception
- Any exception thrown when converting ruleSet to XML.public void setRulesInfo(PasswordRulesInfo rulesInfo)
rulesInfo
- PasswordRulesInfo objectpublic 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 joinIncompatibleRulesException
- when RuleSet object to join contains incompatible rules.public boolean join(Rule rule) throws IncompatibleRulesException
join
in interface Rule
rule
- Rule to joinIncompatibleRulesException
- when RuleSet object to join contains incompatible rules.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
- Thrown when a maximum number of iterations allowed before generating a valid
password is exceeded.public boolean validateSafe(java.lang.String password, ValidationInfo validationInfo)
validateSafe
in interface Rule
validationInfo
- ValidationInfo objectpassword
- Password to validate.public void constrain(PasswordGenerator generator)
constrain
in interface Rule
generator
- Generator which contains a character template(s) to be constrained.public java.lang.String getParameter()
getParameter
in interface Rule
public void setParameter(java.lang.String parameter)
setParameter
in interface Rule
com.ibm.passwordrules.Rule
parameter
- String representing the constraining parameterpublic int getLastIterationCount()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |