Package org.passay
Class PasswordData
- java.lang.Object
-
- org.passay.PasswordData
-
public class PasswordData extends Object
Contains password related information used by rules to perform password validation.- Author:
- Middleware Services
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PasswordData.AbstractReference
Common password reference implementation.static class
PasswordData.HistoricalReference
Reference to an historical password.static class
PasswordData.Origin
Enum to define the origin of a password.static class
PasswordData.PrefixSalt
A salt that is concatenated as a prefix to the password data.static interface
PasswordData.Reference
Reference to another password.static interface
PasswordData.Salt
Combines salt (additional external data) with a password before applying a digest algorithm to them.static class
PasswordData.SourceReference
Reference to a source password.static class
PasswordData.SuffixSalt
A salt that is concatenated as a suffix to the password data.
-
Constructor Summary
Constructors Constructor Description PasswordData()
Default constructor.PasswordData(String p)
Creates a new password data.PasswordData(String u, String p)
Creates a new password data.PasswordData(String u, String p, List<PasswordData.Reference> r)
Creates a new password data.PasswordData(String u, String p, PasswordData.Origin o)
Creates a new password data.PasswordData(String p, PasswordData.Origin o)
Creates a new password data.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PasswordData.Origin
getOrigin()
Returns the origin.String
getPassword()
Returns the password.List<PasswordData.Reference>
getPasswordReferences()
Returns the password references.<T extends PasswordData.Reference>
List<T>getPasswordReferences(Class<T> type)
Returns the password references that match the supplied reference type.String
getUsername()
Returns the username.static PasswordData
newPasswordData(PasswordData data)
Returns a password data initialized with the supplied data.void
setOrigin(PasswordData.Origin o)
Sets the origin.void
setPassword(String p)
Sets the password.void
setPasswordReferences(List<PasswordData.Reference> l)
Sets the password references.void
setPasswordReferences(PasswordData.Reference... r)
Sets the password references.void
setUsername(String s)
Sets the username.String
toString()
-
-
-
Constructor Detail
-
PasswordData
public PasswordData()
Default constructor.
-
PasswordData
public PasswordData(String p)
Creates a new password data. The origin of this data is assumed to bePasswordData.Origin.User
by default.- Parameters:
p
- password
-
PasswordData
public PasswordData(String u, String p)
Creates a new password data. The origin of this data is assumed to bePasswordData.Origin.User
by default.- Parameters:
u
- usernamep
- password
-
PasswordData
public PasswordData(String p, PasswordData.Origin o)
Creates a new password data.- Parameters:
p
- passwordo
- origin
-
PasswordData
public PasswordData(String u, String p, PasswordData.Origin o)
Creates a new password data.- Parameters:
u
- usernamep
- passwordo
- origin
-
PasswordData
public PasswordData(String u, String p, List<PasswordData.Reference> r)
Creates a new password data.- Parameters:
u
- usernamep
- passwordr
- references
-
-
Method Detail
-
setPassword
public void setPassword(String p)
Sets the password.- Parameters:
p
- password
-
getPassword
public String getPassword()
Returns the password.- Returns:
- password
-
setOrigin
public void setOrigin(PasswordData.Origin o)
Sets the origin.- Parameters:
o
- origin
-
getOrigin
public PasswordData.Origin getOrigin()
Returns the origin.- Returns:
- origin
-
setUsername
public void setUsername(String s)
Sets the username.- Parameters:
s
- username
-
getUsername
public String getUsername()
Returns the username.- Returns:
- username
-
getPasswordReferences
public List<PasswordData.Reference> getPasswordReferences()
Returns the password references.- Returns:
- password references
-
getPasswordReferences
public <T extends PasswordData.Reference> List<T> getPasswordReferences(Class<T> type)
Returns the password references that match the supplied reference type.- Type Parameters:
T
- type of password reference- Parameters:
type
- of reference to match- Returns:
- unmodifiable list of password references
-
setPasswordReferences
public void setPasswordReferences(PasswordData.Reference... r)
Sets the password references.- Parameters:
r
- password references
-
setPasswordReferences
public void setPasswordReferences(List<PasswordData.Reference> l)
Sets the password references.- Parameters:
l
- password references
-
newPasswordData
public static PasswordData newPasswordData(PasswordData data)
Returns a password data initialized with the supplied data.- Parameters:
data
- password data to read properties from- Returns:
- password data
-
-