Class RequiredCharactersPasswordRule
Requires that a password contains at least minimumCount required characters.
public class RequiredCharactersPasswordRule : IPasswordRule
- Inheritance
-
RequiredCharactersPasswordRule
- Implements
- Derived
- Inherited Members
Constructors
RequiredCharactersPasswordRule(Func<char, bool>, string, int)
Requires that a password contains at least minimumCount required characters.
public RequiredCharactersPasswordRule(Func<char, bool> isRequiredCharacter, string requirement, int minimumCount = 1)
Parameters
isRequiredCharacterFunc<char, bool>Delegate that returns true iff the parameter is a required character.
requirementstringAn explanation of the type of characters required by this rule.
minimumCountintThe minimum number of required characters that must be present in the password.
Properties
Description
A description of this password rule.
public string Description { get; }
Property Value
Instructions
A string that may be shown to the user when their password is deemed invalid by this rule.
public string Instructions { get; }
Property Value
MinimumCount
public int MinimumCount { get; }
Property Value
Methods
IsValid(string, IEnumerable<string>?)
Validate the supplied password against this rule.
public bool IsValid(string password, IEnumerable<string>? userDataStrings = null)
Parameters
passwordstringThe password to validate
userDataStringsIEnumerable<string>Strings that the application knows about the user supplying the password that this rule may use as part of password validation.
Returns
- bool
Whether the supplied password is valid under this rule.