Class MongoRealmAuthenticator

java.lang.Object
org.restheart.security.authenticators.MongoRealmAuthenticator
All Implemented Interfaces:
io.undertow.security.idm.IdentityManager, ConfigurablePlugin, Plugin, Authenticator

public class MongoRealmAuthenticator extends Object implements Authenticator
Author:
Andrea Di Cesare <andrea@softinstigate.com>
  • Field Details

  • Constructor Details

    • MongoRealmAuthenticator

      public MongoRealmAuthenticator()
  • Method Details

    • init

      public void init()
    • verify

      public io.undertow.security.idm.Account verify(io.undertow.security.idm.Account account)
      Specified by:
      verify in interface Authenticator
      Specified by:
      verify in interface io.undertow.security.idm.IdentityManager
    • verify

      public io.undertow.security.idm.Account verify(String id, io.undertow.security.idm.Credential credential)
      Specified by:
      verify in interface Authenticator
      Specified by:
      verify in interface io.undertow.security.idm.IdentityManager
    • getBcryptComplexity

      public int getBcryptComplexity()
      Returns:
      the bcryptComplexity
    • isBcryptHashedPassword

      public boolean isBcryptHashedPassword()
      Returns:
      true if the password must be hashed
    • getMinimumPasswordStrength

      public int getMinimumPasswordStrength()
      Integer from 0 to 4 0 Weak (guesses invalid input: '<' 3^10) 1 Fair (guesses invalid input: '<' 6^10) 2 Good (guesses invalid input: '<' 8^10) 3 Strong (guesses invalid input: '<' 10^10) 4 Very strong (guesses >= 10^10)
      Returns:
      the minimumPasswordStrength
    • isEnforceMinimumPasswordStrength

      public boolean isEnforceMinimumPasswordStrength()
      Returns:
      true if the password st be hashed
    • verify

      public io.undertow.security.idm.Account verify(io.undertow.security.idm.Credential credential)
      Specified by:
      verify in interface Authenticator
      Specified by:
      verify in interface io.undertow.security.idm.IdentityManager
    • accountIdTrasformer

      protected String accountIdTrasformer(String id)
      Override this method to trasform the account id. By default it returns the id without any transformation. For example, it could be overridden to force the id to be lowercase.
      Parameters:
      id - the account id
      Returns:
      the trasformed account Id (default is identity)
    • getPropPassword

      public String getPropPassword()
      Returns:
      the propPassword
    • getXForwardedHeaderName

      public static io.undertow.util.HttpString getXForwardedHeaderName(String suffix)
    • getXForwardedAccountIdHeaderName

      public static io.undertow.util.HttpString getXForwardedAccountIdHeaderName()
    • getXForwardedRolesHeaderName

      public static io.undertow.util.HttpString getXForwardedRolesHeaderName()
    • checkUserCollection

      public boolean checkUserCollection() throws IllegalStateException
      Throws:
      IllegalStateException
    • countAccounts

      public long countAccounts()
    • createDefaultAccount

      public void createDefaultAccount()
    • findAccount

      public MongoRealmAccount findAccount(String accountId)
    • getUsersDb

      public String getUsersDb()
      Returns:
      the usersDb
    • setUsersDb

      public void setUsersDb(String usersDb)
      Parameters:
      usersDb - the usersDb to set
    • getUsersCollection

      public String getUsersCollection()
      Returns:
      the usersCollection
    • getJsonPathRoles

      public String getJsonPathRoles()
      Returns:
      the jsonPathRoles