Class MongoPasswordUtils
java.lang.Object
dev.getelements.elements.dao.mongo.MongoPasswordUtils
Created by patricktwohig on 6/25/17.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddPasswordToBuilder
(UpdateBuilder builder, String password) Generates salt and password hash according to the configuration and adds the required update operations to the suppliedUpdateBuilder
instance.jakarta.inject.Provider
<MessageDigest> Creates a newMessageDigest
instance used to hash passwordsvoid
scramblePassword
(MongoUser mongoUser) Given the instance ofMongoUser
, this will scramble the password making it extremely impossible for a user to login.scramblePassword
(UpdateBuilder builder) Scrambles both the salt and the password.Scrambles both the salt and the password.scramblePasswordOnInsert
(UpdateBuilder builder) Scrambles both the salt and the password.scramblePasswordOnInsert
(Map<String, Object> insertMap) Scrambles both the salt and the password.void
setMessageDigestProvider
(jakarta.inject.Provider<MessageDigest> messageDigestProvider) void
setPasswordEncoding
(String passwordEncoding)
-
Field Details
-
SALT_LENGTH
public static final int SALT_LENGTH- See Also:
-
-
Constructor Details
-
MongoPasswordUtils
public MongoPasswordUtils()
-
-
Method Details
-
addPasswordToBuilder
Generates salt and password hash according to the configuration and adds the required update operations to the suppliedUpdateBuilder
instance.- Parameters:
builder
- theUpdateBuilder
to mutatepassword
- the password
-
scramblePassword
Scrambles both the salt and the password. This effectively wipes out the account's password making it inaccessible.- Parameters:
builder
- theUpdateBuilder
-
scramblePasswordOnInsert
Scrambles both the salt and the password.- Returns:
- a map with scrambled password added to it
-
scramblePasswordOnInsert
Scrambles both the salt and the password.- Parameters:
insertMap
- the map of objects to set on insert- Returns:
- a map with scrambled password added to it
-
scramblePasswordOnInsert
Scrambles both the salt and the password.- Parameters:
builder
- theUpdateBuilder
-
scramblePassword
Given the instance ofMongoUser
, this will scramble the password making it extremely impossible for a user to login.- Parameters:
mongoUser
- the instance ofMongoUser
-
newPasswordMessageDigest
Creates a newMessageDigest
instance used to hash passwords- Returns:
- the
MessageDigest
used to make the password.
-
getPasswordEncoding
-
getPasswordEncodingCharset
-
setPasswordEncoding
@Inject public void setPasswordEncoding(@Named("dev.getelements.elements.password.encoding") String passwordEncoding) -
getMessageDigestProvider
-
setMessageDigestProvider
@Inject public void setMessageDigestProvider(@Named("dev.getelements.elements.password.digest") jakarta.inject.Provider<MessageDigest> messageDigestProvider)
-