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 suppliedUpdateBuilderinstance.jakarta.inject.Provider<MessageDigest> Creates a newMessageDigestinstance used to hash passwordsvoidscramblePassword(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.voidsetMessageDigestProvider(jakarta.inject.Provider<MessageDigest> messageDigestProvider) voidsetPasswordEncoding(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 suppliedUpdateBuilderinstance.- Parameters:
builder- theUpdateBuilderto 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 newMessageDigestinstance used to hash passwords- Returns:
- the
MessageDigestused 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)
-