Module io.inverno.mod.security.http
Class DigestPassword.Encoder
java.lang.Object
io.inverno.mod.security.http.digest.DigestPassword.Encoder
- All Implemented Interfaces:
Password.Encoder<DigestPassword,
DigestPassword.Encoder>
- Enclosing class:
DigestPassword
public class DigestPassword.Encoder
extends Object
implements Password.Encoder<DigestPassword,DigestPassword.Encoder>
An HTTP Digest password encoder implementation as defined by RFC 7616 Section 3.4.2.
The encoded password corresponds to A1
in RFC 7616 which is constant in the HTTP digest authentication process.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionEncodes the specified raw password.Returns the algorithm.getRealm()
Returns the realm.Returns the username.boolean
Matches the specified raw password with the specified encoded representation.Recovers a password from its encoded representation generated with this encoder.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.inverno.mod.security.authentication.password.Password.Encoder
matches
-
Constructor Details
-
Encoder
Creates a digest password encoder with the specified algorithm, username and realm.
- Parameters:
algorithm
- the algorithmusername
- the usernamerealm
- the realm
-
-
Method Details
-
getAlgorithm
Returns the algorithm.
- Returns:
- the algorithm
-
getUsername
Returns the username.
- Returns:
- the username
-
getRealm
Returns the realm.
- Returns:
- the realm
-
recover
Description copied from interface:Password.Encoder
Recovers a password from its encoded representation generated with this encoder.
- Specified by:
recover
in interfacePassword.Encoder<DigestPassword,
DigestPassword.Encoder> - Parameters:
encoded
- an encoded password representation- Returns:
- a password
- Throws:
PasswordException
- if there was an error recovering the password or if the specified encoded representation was not generated with this encoder
-
encode
Description copied from interface:Password.Encoder
Encodes the specified raw password.
- Specified by:
encode
in interfacePassword.Encoder<DigestPassword,
DigestPassword.Encoder> - Parameters:
raw
- a raw password- Returns:
- an encoded password
- Throws:
PasswordException
- if there was an error encoding the password
-
matches
Description copied from interface:Password.Encoder
Matches the specified raw password with the specified encoded representation.
- Specified by:
matches
in interfacePassword.Encoder<DigestPassword,
DigestPassword.Encoder> - Parameters:
raw
- a raw passwordencoded
- an encoded password- Returns:
- true if passwords match, false otherwise
- Throws:
PasswordException
- if there was an error matching passwords
-