Class PostAuthorizeReactiveAuthorizationManager
java.lang.Object
org.springframework.security.authorization.method.PostAuthorizeReactiveAuthorizationManager
- All Implemented Interfaces:
MethodAuthorizationDeniedHandler,ReactiveAuthorizationManager<MethodInvocationResult>
public final class PostAuthorizeReactiveAuthorizationManager
extends Object
implements ReactiveAuthorizationManager<MethodInvocationResult>, MethodAuthorizationDeniedHandler
A
ReactiveAuthorizationManager which can determine if an Authentication
has access to the returned object from the MethodInvocation by evaluating an
expression from the PostAuthorize annotation.- Since:
- 5.8
-
Constructor Summary
ConstructorsConstructorDescriptionPostAuthorizeReactiveAuthorizationManager(MethodSecurityExpressionHandler expressionHandler) -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<AuthorizationResult>authorize(reactor.core.publisher.Mono<Authentication> authentication, MethodInvocationResult result) Determines if anAuthenticationhas access to the returned object from theMethodInvocationby evaluating an expression from thePostAuthorizeannotation.@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.voidsetApplicationContext(org.springframework.context.ApplicationContext context) voidConfigure pre/post-authorization template resolutionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.security.authorization.ReactiveAuthorizationManager
verify
-
Constructor Details
-
PostAuthorizeReactiveAuthorizationManager
public PostAuthorizeReactiveAuthorizationManager() -
PostAuthorizeReactiveAuthorizationManager
-
-
Method Details
-
setTemplateDefaults
Configure pre/post-authorization template resolutionBy default, this value is
null, which indicates that templates should not be resolved.- Parameters:
defaults- - whether to resolve pre/post-authorization templates parameters- Since:
- 6.4
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext context) -
authorize
public reactor.core.publisher.Mono<AuthorizationResult> authorize(reactor.core.publisher.Mono<Authentication> authentication, MethodInvocationResult result) Determines if anAuthenticationhas access to the returned object from theMethodInvocationby evaluating an expression from thePostAuthorizeannotation.- Specified by:
authorizein interfaceReactiveAuthorizationManager<MethodInvocationResult>- Parameters:
authentication- theMonoof theAuthenticationto checkresult- theMethodInvocationResultto check- Returns:
- a Mono of the
AuthorizationDecisionor an emptyMonoif thePostAuthorizeannotation is not present
-
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
-