Class RequestAuthenticator

java.lang.Object
com.mdsol.mauth.RequestAuthenticator
All Implemented Interfaces:
Authenticator

public class RequestAuthenticator extends Object implements Authenticator
  • Constructor Details

    • RequestAuthenticator

      public RequestAuthenticator(ClientPublicKeyProvider clientPublicKeyProvider)
      Uses 10L as default value for request validation timeout ClientPublicKeyProvider as the EpochTimeProvider
      Parameters:
      clientPublicKeyProvider - PublicKey provider
    • RequestAuthenticator

      public RequestAuthenticator(ClientPublicKeyProvider clientPublicKeyProvider, boolean v2OnlyAuthenticate)
      Uses 10L as default value for request validation timeout ClientPublicKeyProvider as the EpochTimeProvider
      Parameters:
      clientPublicKeyProvider - PublicKey provider
      v2OnlyAuthenticate - the flag to identify authenticate with protocol V2 only or not, if true, clients will authenticate with protocol V2, if false, clients will authenticate with only the highest protocol version (V2 or V1)
    • RequestAuthenticator

      public RequestAuthenticator(ClientPublicKeyProvider clientPublicKeyProvider, long requestValidationTimeoutSeconds)
      Uses ClientPublicKeyProvider as the EpochTimeProvider
      Parameters:
      clientPublicKeyProvider - PublicKey provider
      requestValidationTimeoutSeconds - timeout
    • RequestAuthenticator

      public RequestAuthenticator(ClientPublicKeyProvider clientPublicKeyProvider, long requestValidationTimeoutSeconds, boolean v2OnlyAuthenticate)
      Uses ClientPublicKeyProvider as the EpochTimeProvider
      Parameters:
      clientPublicKeyProvider - PublicKey provider
      requestValidationTimeoutSeconds - timeout
      v2OnlyAuthenticate - the flag to identify authenticate with protocol V2 only or not, if true, clients will authenticate with protocol V2, if false, clients will authenticate with only the highest protocol version (V2 or V1)
    • RequestAuthenticator

      public RequestAuthenticator(ClientPublicKeyProvider clientPublicKeyProvider, long requestValidationTimeoutSeconds, com.mdsol.mauth.util.EpochTimeProvider epochTimeProvider)
    • RequestAuthenticator

      public RequestAuthenticator(ClientPublicKeyProvider clientPublicKeyProvider, long requestValidationTimeoutSeconds, com.mdsol.mauth.util.EpochTimeProvider epochTimeProvider, boolean v2OnlyAuthenticate)
  • Method Details

    • authenticate

      public boolean authenticate(com.mdsol.mauth.MAuthRequest mAuthRequest)
      Description copied from interface: Authenticator
      Performs the validation of an incoming HTTP request. The validation process consists of recreating the mAuth hashed signature from the request data and comparing it to the decrypted hash signature from the mAuth header. mauth_client will authenticate with the highest protocol version present and if authentication fails will fallback to lower protocol versions (if provided)
      Specified by:
      authenticate in interface Authenticator
      Parameters:
      mAuthRequest - Data from the incoming HTTP request necessary to perform the validation.
      Returns:
      True or false indicating if the request is valid or not with respect to mAuth.