Class ObservationAuthorizationManager<T>
java.lang.Object
org.springframework.security.authorization.ObservationAuthorizationManager<T>
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.MessageSourceAware,AuthorizationManager<T>,MethodAuthorizationDeniedHandler
public final class ObservationAuthorizationManager<T>
extends Object
implements AuthorizationManager<T>, org.springframework.context.MessageSourceAware, MethodAuthorizationDeniedHandler
An
AuthorizationManager that observes the authorization- Since:
- 6.0
-
Constructor Summary
ConstructorsConstructorDescriptionObservationAuthorizationManager(io.micrometer.observation.ObservationRegistry registry, AuthorizationManager<T> delegate) -
Method Summary
Modifier and TypeMethodDescription@Nullable AuthorizationResultauthorize(Supplier<? extends @Nullable Authentication> authentication, T object) Determines if access is granted for a specific authentication and object.@Nullable ObjecthandleDeniedInvocation(org.aopalliance.intercept.MethodInvocation methodInvocation, AuthorizationResult authorizationResult) Handle denied method invocations, implementations might either throw anAuthorizationDeniedExceptionor a replacement result instead of invoking the method, e.g.@Nullable ObjecthandleDeniedInvocationResult(MethodInvocationResult methodInvocationResult, AuthorizationResult authorizationResult) Handle denied method invocations, implementations might either throw anAuthorizationDeniedExceptionor a replacement result instead of invoking the method, e.g.voidsetMessageSource(org.springframework.context.MessageSource messageSource) Set the MessageSource that this object runs in.voidsetObservationConvention(io.micrometer.observation.ObservationConvention<AuthorizationObservationContext<?>> convention) Use the provided convention for reporting observation dataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.security.authorization.AuthorizationManager
verify
-
Constructor Details
-
ObservationAuthorizationManager
public ObservationAuthorizationManager(io.micrometer.observation.ObservationRegistry registry, AuthorizationManager<T> delegate)
-
-
Method Details
-
authorize
public @Nullable AuthorizationResult authorize(Supplier<? extends @Nullable Authentication> authentication, T object) Description copied from interface:AuthorizationManagerDetermines if access is granted for a specific authentication and object.- Specified by:
authorizein interfaceAuthorizationManager<T>- Parameters:
authentication- theSupplierof theAuthenticationto authorizeobject- theAuthorizationManagerobject to authorize- Returns:
- an
AuthorizationResult
-
setObservationConvention
public void setObservationConvention(io.micrometer.observation.ObservationConvention<AuthorizationObservationContext<?>> convention) Use the provided convention for reporting observation data- Parameters:
convention- The provided convention- Since:
- 6.1
-
setMessageSource
public void setMessageSource(org.springframework.context.MessageSource messageSource) Set the MessageSource that this object runs in.- Specified by:
setMessageSourcein interfaceorg.springframework.context.MessageSourceAware- Parameters:
messageSource- The message source to be used by this object- Since:
- 6.2
-
handleDeniedInvocation
public @Nullable Object handleDeniedInvocation(org.aopalliance.intercept.MethodInvocation methodInvocation, AuthorizationResult authorizationResult) Description copied from interface:MethodAuthorizationDeniedHandlerHandle denied method invocations, implementations might either throw anAuthorizationDeniedExceptionor a replacement result instead of invoking the method, e.g. a masked value.- Specified by:
handleDeniedInvocationin interfaceMethodAuthorizationDeniedHandler- Parameters:
methodInvocation- theMethodInvocationrelated to the authorization deniedauthorizationResult- the authorization denied result- Returns:
- a replacement result for the denied method invocation, or null, or a
Monofor reactive applications
-
handleDeniedInvocationResult
public @Nullable Object handleDeniedInvocationResult(MethodInvocationResult methodInvocationResult, AuthorizationResult authorizationResult) Description copied from interface:MethodAuthorizationDeniedHandlerHandle denied method invocations, implementations might either throw anAuthorizationDeniedExceptionor a replacement result instead of invoking the method, e.g. a masked value. By default, this method invokesMethodAuthorizationDeniedHandler.handleDeniedInvocation(MethodInvocation, AuthorizationResult).- Specified by:
handleDeniedInvocationResultin interfaceMethodAuthorizationDeniedHandler- Parameters:
methodInvocationResult- the object containing theMethodInvocationand the result producedauthorizationResult- the authorization denied result- Returns:
- a replacement result for the denied method invocation, or null, or a
Monofor reactive applications
-