com.holonplatform.auth.internal

## Class DefaultCredentialsMatcher

- java.lang.Object
- - com.holonplatform.auth.internal.DefaultCredentialsMatcher

- All Implemented Interfaces:
    CredentialsContainer.CredentialsMatcher

      public class DefaultCredentialsMatcher
      extends Object
      implements CredentialsContainer.CredentialsMatcher

  Default `CredentialsContainer.CredentialsMatcher` implementation that employs best-practices and common behaviours to perform credentials validation and matching.
  Since:
    5.0.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultCredentialsMatcher()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `credentialsMatch(CredentialsContainer provided, CredentialsContainer stored)` Check if provided credentials match the given stored credentials
    `static byte[]` | `toBytes(Object o)` Try to convert the given Object into a byte array.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultCredentialsMatcher

          public DefaultCredentialsMatcher()

  - ### Method Detail

    - #### credentialsMatch

          public boolean credentialsMatch(CredentialsContainer provided,
                                          CredentialsContainer stored)
                                   throws AuthenticationException

      Description copied from interface: `CredentialsContainer.CredentialsMatcher`
      Check if provided credentials match the given stored credentials
      Specified by:
        `credentialsMatch` in interface `CredentialsContainer.CredentialsMatcher`
      Parameters:
        `provided` - Provided credentials
        `stored` - Stored credentials to match
      Returns:
        `true` if the provided credentials match the stored credentials, `false` otherwise.
      Throws:
        `AuthenticationException` - Error during credentials match (e.g. invalid or unknown credentials)

    - #### toBytes

          public static byte[] toBytes(Object o)

      Try to convert the given Object into a byte array.

      Supported inputs are `byte[]`, `char[]`, `String`, `InputStream` and `File`. Otherwise, an `IllegalArgumentException` will be thrown.

      Parameters:
        `o` - the Object to convert into a byte array
      Returns:
        a byte array representation of the Object

Copyright © 2019 The Holon Platform. All rights reserved.