Package com.logicaldoc.core.security.authentication

# Class AuthenticationChain

java.lang.Object
com.logicaldoc.core.security.authentication.AbstractAuthenticator
com.logicaldoc.core.security.authentication.AuthenticationChain

All Implemented Interfaces:
  `Authenticator`

@Component("authenticationChain") public class AuthenticationChain extends AbstractAuthenticator
This authentication component implements a chain of possible authentication sources that will be invoked sequentially.

Since:
  4.5
Author:
  Sebastian Wenzky

## Constructor Summary

Constructors
Constructor
Description
`AuthenticationChain()`

## Method Summary

Modifier and Type
Method
Description
`final User`
`authenticate(String username, String password)`
Authenticates the user using the given credentials, if successful, the corresponding user is returned.
`final 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
`void`
`init()`
Populate the authenticators chain using the extension point Authentication declared in the core plug-in.
`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

### Methods inherited from class com.logicaldoc.core.security.authentication.AbstractAuthenticator

`authenticate`

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

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

## Constructor Details

### AuthenticationChain

public AuthenticationChain()

## Method Details

### authenticate

public final User authenticate(String username, String password) throws AuthenticationException
Description copied from interface: `Authenticator`
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

public final User authenticate(String username, String password, String key, Client client) throws AuthenticationException
Description copied from interface: `Authenticator`
Authenticates the user using the given credentials, if successful, the corresponding user is returned.

Specified by:
  `authenticate` in interface `Authenticator`
Overrides:
  `authenticate` in class `AbstractAuthenticator`
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`

### pickUser

public User pickUser(String username)
Description copied from interface: `Authenticator`
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

### canAuthenticateUser

public boolean canAuthenticateUser(String user)
Description copied from interface: `Authenticator`
Checks if this authenticator can authenticate a user

Specified by:
  `canAuthenticateUser` in interface `Authenticator`
Overrides:
  `canAuthenticateUser` in class `AbstractAuthenticator`
Parameters:
  `user` - the username to authenticate
Returns:
  true only if this authenticator can authenticate the giver username

### init

public void init()
Populate the authenticators chain using the extension point Authentication declared in the core plug-in.

### isEnabled

public boolean isEnabled()
Description copied from interface: `Authenticator`
A provider can be in a disabled state

Specified by:
  `isEnabled` in interface `Authenticator`
Overrides:
  `isEnabled` in class `AbstractAuthenticator`
Returns:
  if this authenticator is enabled