Package com.logicaldoc.core.security.authentication

# Interface Authenticator

All Known Implementing Classes:
  `AbstractAuthenticator`, `ApiKeyAuthenticator`, `AuthenticationChain`, `DefaultAuthenticator`

public interface Authenticator
Implementations of this interface must provide authentication of a user against a defined source.

Since:
  4.5
Author:
  Sebastian Wenzky

## Method Summary

Modifier and Type
Method
Description
`User`
`authenticate(String username, String password)`
Authenticates the user using the given credentials, if successful, the corresponding user is returned.
`User`
`authenticate(String username, String password, String key)`
Authenticates the user using the given credentials, if successful, the corresponding user is returned.
`User`
`authenticate(String username, String password, String key, Client client)`
Authenticates the user using the given credentials, if successful, the corresponding user is returned.
`boolean`
`canAuthenticateUser(String user)`
Checks if this authenticator can authenticate a user
`boolean`
`isEnabled()`
A provider can be in a disabled state
`User`
`pickUser(String username)`
This method does not authenticate the user but just retrieves his details

## Method Details

### authenticate

User authenticate(String username, String password) throws AuthenticationException
Authenticates the user using the given credentials, if successful, the corresponding user is returned.

Parameters:
  `username` - the username
  `password` - the password
Returns:
  The user, or null if the authentication was unsuccessful
Throws:
  `AuthenticationException`

### authenticate

User authenticate(String username, String password, String key) throws AuthenticationException
Authenticates the user using the given credentials, if successful, the corresponding user is returned.

Parameters:
  `username` - the username
  `password` - the password
  `key` - Optional third authentication parameter
Returns:
  The user, or null if the authentication was unsuccessful
Throws:
  `AuthenticationException`

### authenticate

User authenticate(String username, String password, String key, Client client) throws AuthenticationException
Authenticates the user using the given credentials, if successful, the corresponding user is returned.

Parameters:
  `username` - the username
  `password` - the password
  `key` - Optional third authentication parameter
  `client` - Client informations
Returns:
  The user, or null if the authentication was unsuccessful
Throws:
  `AuthenticationException`

### canAuthenticateUser

boolean canAuthenticateUser(String user)
Checks if this authenticator can authenticate a user

Parameters:
  `user` - the username to authenticate
Returns:
  true only if this authenticator can authenticate the giver username

### isEnabled

boolean isEnabled()
A provider can be in a disabled state

Returns:
  if this authenticator is enabled

### pickUser

User pickUser(String username) throws PersistenceException
This method does not authenticate the user but just retrieves his details

Parameters:
  `username` - username of the user to find
Returns:
  object representation of the user
Throws:
  `PersistenceException` - Error in data layer