Package org.springframework.security.authorization

# Class AuthorizationObservationContext<T>

java.lang.Object
io.micrometer.observation.Observation.Context
org.springframework.security.authorization.AuthorizationObservationContext<T>

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

public class AuthorizationObservationContext<T> extends io.micrometer.observation.Observation.Context
An `Observation.Context` used during authorizations

Since:
  6.0

## Constructor Summary

Constructors
Constructor
Description
`AuthorizationObservationContext(T object)`

## Method Summary

Modifier and Type
Method
Description
`Authentication`
`getAuthentication()`
Get the observed `Authentication` for this authorization
`AuthorizationResult`
`getAuthorizationResult()`
Get the observed `AuthorizationResult`
`AuthorizationDecision`
`getDecision()`
Deprecated.
please use `getAuthorizationResult()` instead
`T`
`getObject()`
Get the object for which access was requested
`void`
`setAuthentication(Authentication authentication)`
Set the observed `Authentication` for this authorization
`void`
`setAuthorizationResult(AuthorizationResult authorizationResult)`
Set the observed `AuthorizationResult`
`void`
`setDecision(AuthorizationDecision decision)`
Deprecated.
please use `setAuthorizationResult(AuthorizationResult)` instead

### 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

### AuthorizationObservationContext

public AuthorizationObservationContext(T object)

## Method Details

### getAuthentication

public Authentication getAuthentication()
Get the observed `Authentication` for this authorization

Note that if the authorization did not require inspecting the `Authentication`, this will return `null`.

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

### setAuthentication

public void setAuthentication(Authentication authentication)
Set the observed `Authentication` for this authorization

Parameters:
  `authentication` - the observed `Authentication`

### getObject

public T getObject()
Get the object for which access was requested

Returns:
  the requested object

### getDecision

@Deprecated public AuthorizationDecision getDecision()
Deprecated.
please use `getAuthorizationResult()` instead
Get the observed `AuthorizationDecision`

Returns:
  the observed `AuthorizationDecision`

### setDecision

@Deprecated public void setDecision(AuthorizationDecision decision)
Deprecated.
please use `setAuthorizationResult(AuthorizationResult)` instead
Set the observed `AuthorizationDecision`

Parameters:
  `decision` - the observed `AuthorizationDecision`

### getAuthorizationResult

public AuthorizationResult getAuthorizationResult()
Get the observed `AuthorizationResult`

Returns:
  the observed `AuthorizationResult`
Since:
  6.4

### setAuthorizationResult

public void setAuthorizationResult(AuthorizationResult authorizationResult)
Set the observed `AuthorizationResult`

Parameters:
  `authorizationResult` - the observed `AuthorizationResult`
Since:
  6.4