Interface Authentication

All Superinterfaces:
Principal, Serializable
All Known Implementing Classes:
AuthenticationJWTClaimsSetAdapter, ClientAuthentication, ServerAuthentication, X509Authentication

public interface Authentication extends Principal, Serializable
Represents the state of an authentication.
Since:
1.0
Author:
James Kleeh
  • Method Details

    • getAttributes

      @NonNull @NonNull Map<String,Object> getAttributes()
      In order to correctly implement the Serializable specification, this map should be Map<String, Serializable>, however that would place a burden on those not requiring serialization, forcing their values to conform to that spec. This is left intentionally as Object in order to meet both use cases and those requiring serialization must ensure all values in the map implement Serializable.
      Returns:
      Any additional attributes in the authentication
    • getRoles

      @NonNull default @NonNull Collection<String> getRoles()
      Returns:
      Any roles associated with the authentication
    • build

      @NonNull static @NonNull Authentication build(@NonNull @NonNull String username)
      Builds an Authentication instance for the user.
      Parameters:
      username - User's name
      Returns:
      An Authentication for the User
    • build

      @NonNull static @NonNull Authentication build(@NonNull @NonNull String username, @NonNull @NonNull Collection<String> roles)
      Builds an Authentication instance for the user.
      Parameters:
      username - User's name
      roles - User's roles
      Returns:
      An Authentication for the User
    • build

      @NonNull static @NonNull Authentication build(@NonNull @NonNull String username, @NonNull @NonNull Map<String,Object> attributes)
      Builds an Authentication instance for the user.
      Parameters:
      username - User's name
      attributes - User's attributes
      Returns:
      An Authentication for the User
    • build

      @NonNull static @NonNull Authentication build(@NonNull @NonNull String username, @Nullable @Nullable Collection<String> roles, @Nullable @Nullable Map<String,Object> attributes)
      Builds an Authentication instance for the user.
      Parameters:
      username - User's name
      roles - User's roles
      attributes - User's attributes
      Returns:
      An Authentication for the User