Class PreAuthorizeReactiveAuthorizationManager
java.lang.Object
org.springframework.security.authorization.method.PreAuthorizeReactiveAuthorizationManager
- All Implemented Interfaces:
MethodAuthorizationDeniedHandler
,ReactiveAuthorizationManager<org.aopalliance.intercept.MethodInvocation>
public final class PreAuthorizeReactiveAuthorizationManager
extends Object
implements ReactiveAuthorizationManager<org.aopalliance.intercept.MethodInvocation>, MethodAuthorizationDeniedHandler
A
ReactiveAuthorizationManager
which can determine if an Authentication
has access to the MethodInvocation
by evaluating an expression from the
PreAuthorize
annotation.- Since:
- 5.8
-
Constructor Summary
ConstructorDescriptionPreAuthorizeReactiveAuthorizationManager
(MethodSecurityExpressionHandler expressionHandler) -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<AuthorizationDecision>
check
(reactor.core.publisher.Mono<Authentication> authentication, org.aopalliance.intercept.MethodInvocation mi) Determines if anAuthentication
has access to theMethodInvocation
by evaluating an expression from thePreAuthorize
annotation.handleDeniedInvocation
(org.aopalliance.intercept.MethodInvocation methodInvocation, AuthorizationResult authorizationResult) Handle denied method invocations, implementations might either throw anAuthorizationDeniedException
or a replacement result instead of invoking the method, e.g.void
setApplicationContext
(org.springframework.context.ApplicationContext context) void
setTemplateDefaults
(PrePostTemplateDefaults defaults) Configure pre/post-authorization template resolutionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.security.authorization.method.MethodAuthorizationDeniedHandler
handleDeniedInvocationResult
Methods inherited from interface org.springframework.security.authorization.ReactiveAuthorizationManager
verify
-
Constructor Details
-
PreAuthorizeReactiveAuthorizationManager
public PreAuthorizeReactiveAuthorizationManager() -
PreAuthorizeReactiveAuthorizationManager
-
-
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.3
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext context) -
check
public reactor.core.publisher.Mono<AuthorizationDecision> check(reactor.core.publisher.Mono<Authentication> authentication, org.aopalliance.intercept.MethodInvocation mi) Determines if anAuthentication
has access to theMethodInvocation
by evaluating an expression from thePreAuthorize
annotation.- Specified by:
check
in interfaceReactiveAuthorizationManager<org.aopalliance.intercept.MethodInvocation>
- Parameters:
authentication
- theMono
of theAuthentication
to checkmi
- theMethodInvocation
to check- Returns:
- a
Mono
of theAuthorizationDecision
or an emptyMono
if thePreAuthorize
annotation is not present
-
handleDeniedInvocation
public Object handleDeniedInvocation(org.aopalliance.intercept.MethodInvocation methodInvocation, AuthorizationResult authorizationResult) Description copied from interface:MethodAuthorizationDeniedHandler
Handle denied method invocations, implementations might either throw anAuthorizationDeniedException
or a replacement result instead of invoking the method, e.g. a masked value.- Specified by:
handleDeniedInvocation
in interfaceMethodAuthorizationDeniedHandler
- Parameters:
methodInvocation
- theMethodInvocation
related to the authorization deniedauthorizationResult
- the authorization denied result- Returns:
- a replacement result for the denied method invocation, or null, or a
Mono
for reactive applications
-