Class MongoPasswordUtils

java.lang.Object
dev.getelements.elements.dao.mongo.MongoPasswordUtils

public class MongoPasswordUtils extends Object
Created by patricktwohig on 6/25/17.
  • Field Details

  • Constructor Details

    • MongoPasswordUtils

      public MongoPasswordUtils()
  • Method Details

    • addPasswordToBuilder

      public UpdateBuilder addPasswordToBuilder(UpdateBuilder builder, String password)
      Generates salt and password hash according to the configuration and adds the required update operations to the supplied UpdateBuilder instance.
      Parameters:
      builder - the UpdateBuilder to mutate
      password - the password
    • scramblePassword

      public UpdateBuilder scramblePassword(UpdateBuilder builder)
      Scrambles both the salt and the password. This effectively wipes out the account's password making it inaccessible.
      Parameters:
      builder - the UpdateBuilder
    • scramblePasswordOnInsert

      public Map<String,Object> scramblePasswordOnInsert()
      Scrambles both the salt and the password.
      Returns:
      a map with scrambled password added to it
    • scramblePasswordOnInsert

      public Map<String,Object> scramblePasswordOnInsert(Map<String,Object> insertMap)
      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

      public UpdateBuilder scramblePasswordOnInsert(UpdateBuilder builder)
      Scrambles both the salt and the password.
      Parameters:
      builder - the UpdateBuilder
    • scramblePassword

      public void scramblePassword(MongoUser mongoUser)
      Given the instance of MongoUser, this will scramble the password making it extremely impossible for a user to login.
      Parameters:
      mongoUser - the instance of MongoUser
    • newPasswordMessageDigest

      public MessageDigest newPasswordMessageDigest()
      Creates a new MessageDigest instance used to hash passwords
      Returns:
      the MessageDigest used to make the password.
    • getPasswordEncoding

      public String getPasswordEncoding()
    • getPasswordEncodingCharset

      public Charset getPasswordEncodingCharset()
    • setPasswordEncoding

      @Inject public void setPasswordEncoding(@Named("dev.getelements.elements.password.encoding") String passwordEncoding)
    • getMessageDigestProvider

      public jakarta.inject.Provider<MessageDigest> getMessageDigestProvider()
    • setMessageDigestProvider

      @Inject public void setMessageDigestProvider(@Named("dev.getelements.elements.password.digest") jakarta.inject.Provider<MessageDigest> messageDigestProvider)