Class SpringAuthorizationEventPublisher
- java.lang.Object
-
- org.springframework.security.authorization.SpringAuthorizationEventPublisher
-
- All Implemented Interfaces:
AuthorizationEventPublisher
public final class SpringAuthorizationEventPublisher extends java.lang.Object implements AuthorizationEventPublisher
An implementation ofAuthorizationEventPublisher
that uses Spring's event publishing support. BecauseAuthorizationGrantedEvent
s typically require additional business logic to decide whether to publish, this implementation only publishesAuthorizationDeniedEvent
s.- Since:
- 5.7
-
-
Constructor Summary
Constructors Constructor Description SpringAuthorizationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
Construct this publisher using Spring'sApplicationEventPublisher
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> void
publishAuthorizationEvent(java.util.function.Supplier<Authentication> authentication, T object, AuthorizationDecision decision)
Publish the given details in the form of an event, typicallyAuthorizationGrantedEvent
orAuthorizationDeniedEvent
.
-
-
-
Method Detail
-
publishAuthorizationEvent
public <T> void publishAuthorizationEvent(java.util.function.Supplier<Authentication> authentication, T object, AuthorizationDecision decision)
Publish the given details in the form of an event, typicallyAuthorizationGrantedEvent
orAuthorizationDeniedEvent
. Note that success events can be very noisy if enabled by default. Because of this implementations may choose to drop success events by default.- Specified by:
publishAuthorizationEvent
in interfaceAuthorizationEventPublisher
- Type Parameters:
T
- the secured object's type- Parameters:
authentication
- aSupplier
for the current userobject
- the secured objectdecision
- the decision about whether the user may access the secured object
-
-