public class Md5PasswordEncoder extends Object implements PasswordEncoder
Constructor and Description |
---|
Md5PasswordEncoder() |
Modifier and Type | Method and Description |
---|---|
String |
encodePassword(String rawPass)
Encodes the specified raw password with an implementation specific algorithm.
|
boolean |
isPasswordValid(String encPass,
String rawPass)
Validates a specified "raw" password against an encoded password.
|
public String encodePassword(String rawPass) throws EncodingException
PasswordEncoder
This will generally be a one-way message digest such as MD5 or SHA, but may also be a plaintext variant which does no encoding at all, but rather returns the same password it was fed. The latter is useful to plug in when the original password must be stored as-is.
encodePassword
in interface PasswordEncoder
rawPass
- the password to encodeEncodingException
- if couldn't encode the raw passwordpublic boolean isPasswordValid(String encPass, String rawPass) throws EncodingException
PasswordEncoder
The encoded password
should have previously been generated by PasswordEncoder.encodePassword(String)
. This method will
encode the rawPass
, and then compare it with the presented encPass
.
isPasswordValid
in interface PasswordEncoder
encPass
- a pre-encoded passwordrawPass
- a raw password to encode and compare against the pre-encoded passwordEncodingException
- if couldn't encode the raw password (see PasswordEncoder.encodePassword(String)
)Copyright © GigaSpaces.