Class AnonymousAuthenticationWebFilter
java.lang.Object
org.springframework.security.web.server.authentication.AnonymousAuthenticationWebFilter
- All Implemented Interfaces:
org.springframework.web.server.WebFilter
public class AnonymousAuthenticationWebFilter
extends Object
implements org.springframework.web.server.WebFilter
Detects if there is no
Authentication
object in the
ReactiveSecurityContextHolder
, and populates it with one if needed.- Since:
- 5.2.0
-
Constructor Summary
ConstructorDescriptionCreates a filter with a principal named "anonymousUser" and the single authority "ROLE_ANONYMOUS".AnonymousAuthenticationWebFilter
(String key, Object principal, List<org.springframework.security.core.GrantedAuthority> authorities) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.security.core.Authentication
createAuthentication
(org.springframework.web.server.ServerWebExchange exchange) reactor.core.publisher.Mono<Void>
filter
(org.springframework.web.server.ServerWebExchange exchange, org.springframework.web.server.WebFilterChain chain)
-
Constructor Details
-
AnonymousAuthenticationWebFilter
Creates a filter with a principal named "anonymousUser" and the single authority "ROLE_ANONYMOUS".- Parameters:
key
- the key to identify tokens created by this filter
-
AnonymousAuthenticationWebFilter
public AnonymousAuthenticationWebFilter(String key, Object principal, List<org.springframework.security.core.GrantedAuthority> authorities) - Parameters:
key
- key the key to identify tokens created by this filterprincipal
- the principal which will be used to represent anonymous usersauthorities
- the authority list for anonymous users
-
-
Method Details
-
filter
public reactor.core.publisher.Mono<Void> filter(org.springframework.web.server.ServerWebExchange exchange, org.springframework.web.server.WebFilterChain chain) - Specified by:
filter
in interfaceorg.springframework.web.server.WebFilter
-
createAuthentication
protected org.springframework.security.core.Authentication createAuthentication(org.springframework.web.server.ServerWebExchange exchange)
-