Package org.springframework.security.authentication

# Class AuthenticationObservationContext

java.lang.Object
io.micrometer.observation.Observation.Context
org.springframework.security.authentication.AuthenticationObservationContext

All Implemented Interfaces:
  `io.micrometer.observation.Observation.ContextView`

public class AuthenticationObservationContext extends io.micrometer.observation.Observation.Context
An `Observation.Context` used during authentications

Since:
  6.0

## Constructor Summary

Constructors
Constructor
Description
`AuthenticationObservationContext()`

## Method Summary

Modifier and Type
Method
Description
`Class<?>`
`getAuthenticationManagerClass()`
Get the `AuthenticationManager` class that processed the authentication
`Authentication`
`getAuthenticationRequest()`
Get the `Authentication` request that was observed
`Authentication`
`getAuthenticationResult()`
Get the `Authentication` result that was observed
`void`
`setAuthenticationManagerClass(Class<?> authenticationManagerClass)`
Set the `AuthenticationManager` class that processed the authentication
`void`
`setAuthenticationRequest(Authentication authenticationRequest)`
Set the `Authentication` request that was observed
`void`
`setAuthenticationResult(Authentication authenticationResult)`
Set the `Authentication` result that was observed

### Methods inherited from class io.micrometer.observation.Observation.Context

`addHighCardinalityKeyValue, addHighCardinalityKeyValues, addLowCardinalityKeyValue, addLowCardinalityKeyValues, clear, computeIfAbsent, containsKey, get, getAllKeyValues, getContextualName, getError, getHighCardinalityKeyValue, getHighCardinalityKeyValues, getLowCardinalityKeyValue, getLowCardinalityKeyValues, getName, getOrDefault, getParentObservation, getRequired, put, remove, removeHighCardinalityKeyValue, removeHighCardinalityKeyValues, removeLowCardinalityKeyValue, removeLowCardinalityKeyValues, setContextualName, setError, setName, setParentObservation, toString`

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

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

### Methods inherited from interface io.micrometer.observation.Observation.ContextView

`getOrDefault`

## Constructor Details

### AuthenticationObservationContext

public AuthenticationObservationContext()

## Method Details

### getAuthenticationRequest

public Authentication getAuthenticationRequest()
Get the `Authentication` request that was observed

Returns:
  the observed `Authentication` request

### setAuthenticationRequest

public void setAuthenticationRequest(Authentication authenticationRequest)
Set the `Authentication` request that was observed

Parameters:
  `authenticationRequest` - the observed `Authentication` request

### getAuthenticationResult

public Authentication getAuthenticationResult()
Get the `Authentication` result that was observed

Note that if authentication failed, no `Authentication` result can be observed. In that case, this returns `null`.

Returns:
  any observed `Authentication` result, `null` otherwise

### setAuthenticationResult

public void setAuthenticationResult(Authentication authenticationResult)
Set the `Authentication` result that was observed

Parameters:
  `authenticationResult` - the observed `Authentication` result

### getAuthenticationManagerClass

public Class<?> getAuthenticationManagerClass()
Get the `AuthenticationManager` class that processed the authentication

Returns:
  the observed `AuthenticationManager` class

### setAuthenticationManagerClass

public void setAuthenticationManagerClass(Class<?> authenticationManagerClass)
Set the `AuthenticationManager` class that processed the authentication

Parameters:
  `authenticationManagerClass` - the observed `AuthenticationManager` class