Interface CredentialsMatcher<A extends Credentials,B extends Credentials>

Type Parameters:
A - the type of the credentials
B - the type of the other credentials
All Known Implementing Classes:
DigestCredentialsMatcher, LoginCredentialsMatcher
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface CredentialsMatcher<A extends Credentials,B extends Credentials>

A credentials matcher can be used during an authentication to match two credentials, typically the one provided by the entity to authenticated and the one resolved from a trusted authority or repository.

an Authenticator implemention can typically relies on a credentials matcher to determine whether the credentials provided by an entity are matching the credentials obtained from a trusted source (i.e. a trusted repository, a trusted directory service...).

Since:
1.5
Author:
Jeremy Kuhn
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    matches(A credentials, B otherCredentials)
    Determines whether the two specified credentials are matching.
  • Method Details

    • matches

      boolean matches(A credentials, B otherCredentials) throws SecurityException

      Determines whether the two specified credentials are matching.

      This method must be:

      • reflexive: matches(credentials, credentials) should return true
      • symetric: if matches(credentials1, credentials2) returns true (matches(credentials2, credentials1)) should also return true
      • transitive: if matches(credentials1, credentials2) returns true and matches(credentials2, credentials3) returns true then matches(credentials1, credentials3) should also return true

      However this method does not have to be consistent: multiple invocations of matches(credentials1, credentials2) are not guaranteed to always return the same result.

      Parameters:
      credentials - the credentials
      otherCredentials - the other credentials
      Returns:
      true if the credentials matches the other credentials, false otherwise
      Throws:
      SecurityException - if there was an error matching credentials