Module io.inverno.mod.security
Interface Password<A extends Password<A,B>,B extends Password.Encoder<A,B>>
- Type Parameters:
A
- the password typeB
- the password encoder type
- All Known Implementing Classes:
AbstractPassword
,Argon2Password
,BCryptPassword
,DigestPassword
,MessageDigestPassword
,PBKDF2Password
,RawPassword
,SCryptPassword
public interface Password<A extends Password<A,B>,B extends Password.Encoder<A,B>>
A password represents secret data that can be used to authenticate an entity.
A password is kept safe by encoding its raw representation in a way that makes it difficult for an attacker to compute it or guess it. This representation exists to provide a secure way to manipulate and store password data. It allows encoding a password and match a raw password with an encoded representation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Password.Encoder<A extends Password<A,
B>, B extends Password.Encoder<A, B>> A password encoder used to encode a raw password into a secured password representation. -
Method Summary
Modifier and TypeMethodDescriptionReturns the password encoder.getValue()
Returns the representation of the password encoded with the password encoder.default boolean
Determines whether the password matches the specified password.default boolean
Determines whether the password matches the specified raw password.
-
Method Details
-
getValue
String getValue()Returns the representation of the password encoded with the password encoder.
- Returns:
- the encoded password representation
-
getEncoder
B getEncoder()Returns the password encoder.
- Returns:
- a password encoder
-
matches
Determines whether the password matches the specified raw password.
- Parameters:
raw
- the raw password to match- Returns:
- true if the password matches the raw password, false otherwise
- Throws:
PasswordException
- if there was an error matching passwords
-
matches
Determines whether the password matches the specified password.
- Parameters:
other
- the password to match- Returns:
- true if the password matches the other password, false otherwise
- Throws:
PasswordException
- if there was an error matching passwords or if the specified password is of an incompatible type
-