Class InMemoryLoginCredentialsResolver

java.lang.Object
io.inverno.mod.security.authentication.InMemoryLoginCredentialsResolver
All Implemented Interfaces:
CredentialsResolver<LoginCredentials>

public class InMemoryLoginCredentialsResolver extends Object implements CredentialsResolver<LoginCredentials>

A simple login credentials resolver that stores credentials in memory.

This is a convenient implementation that should not be used to create properly secured applications.

Since:
1.5
Author:
Jeremy Kuhn
  • Constructor Details

    • InMemoryLoginCredentialsResolver

      public InMemoryLoginCredentialsResolver()

      Creates an empty login credentials resolver.

    • InMemoryLoginCredentialsResolver

      public InMemoryLoginCredentialsResolver(List<LoginCredentials> credentials)

      Creates a login credentials resolver initialized with the specified list of credentials.

      Parameters:
      credentials - a list of credentials
  • Method Details

    • put

      public void put(String username, Password<?,?> password)

      Adds/Sets the login credentials identified by the secified username.

      Parameters:
      username - a username
      password - a password
    • put

      public void put(LoginCredentials credentials)

      Adds/Sets the specified login credentials.

      Parameters:
      credentials - login credentials
    • remove

      public LoginCredentials remove(String username)

      Removes the login credentials identified by the specified username.

      Parameters:
      username - a username
      Returns:
      the removed credentials or null if no credentials were removed
    • resolveCredentials

      public Mono<LoginCredentials> resolveCredentials(String id) throws AuthenticationException
      Description copied from interface: CredentialsResolver

      Returns trusted credentials for the specified identifier.

      Specified by:
      resolveCredentials in interface CredentialsResolver<LoginCredentials>
      Parameters:
      id - the identifier of the credentials to resolve
      Returns:
      a mono emitting the credentials or an empty mono if no credentials exist with the specified identifier
      Throws:
      AuthenticationException