Package org.springframework.security.authentication

# Class ObservationAuthenticationManager

java.lang.Object
org.springframework.security.authentication.ObservationAuthenticationManager

All Implemented Interfaces:
  `AuthenticationManager`

public final class ObservationAuthenticationManager extends Object implements AuthenticationManager
An `AuthenticationManager` that observes the authentication

Since:
  6.0

## Constructor Summary

Constructors
Constructor
Description
`ObservationAuthenticationManager(io.micrometer.observation.ObservationRegistry registry, AuthenticationManager delegate)`

## Method Summary

Modifier and Type
Method
Description
`Authentication`
`authenticate(Authentication authentication)`
Attempts to authenticate the passed `Authentication` object, returning a fully populated `Authentication` object (including granted authorities) if successful.
`void`
`setObservationConvention(io.micrometer.observation.ObservationConvention<AuthenticationObservationContext> convention)`
Use the provided convention for reporting observation data

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

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

## Constructor Details

### ObservationAuthenticationManager

public ObservationAuthenticationManager(io.micrometer.observation.ObservationRegistry registry, AuthenticationManager delegate)

## Method Details

### authenticate

public Authentication authenticate(Authentication authentication) throws AuthenticationException
Description copied from interface: `AuthenticationManager`
Attempts to authenticate the passed `Authentication` object, returning a fully populated `Authentication` object (including granted authorities) if successful.

An `AuthenticationManager` must honour the following contract concerning exceptions:

- A `DisabledException` must be thrown if an account is disabled and the `AuthenticationManager` can test for this state.
- A `LockedException` must be thrown if an account is locked and the `AuthenticationManager` can test for account locking.
- A `BadCredentialsException` must be thrown if incorrect credentials are presented. Whilst the above exceptions are optional, an `AuthenticationManager` must always test credentials.

Exceptions should be tested for and if applicable thrown in the order expressed above (i.e. if an account is disabled or locked, the authentication request is immediately rejected and the credentials testing process is not performed). This prevents credentials being tested against disabled or locked accounts.

Specified by:
  `authenticate` in interface `AuthenticationManager`
Parameters:
  `authentication` - the authentication request object
Returns:
  a fully authenticated object including credentials
Throws:
  `AuthenticationException` - if authentication fails

### setObservationConvention

public void setObservationConvention(io.micrometer.observation.ObservationConvention<AuthenticationObservationContext> convention)
Use the provided convention for reporting observation data

Parameters:
  `convention` - The provided convention
Since:
  6.1