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 Details

    • AnonymousAuthenticationWebFilter

      public AnonymousAuthenticationWebFilter(String key)
      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<GrantedAuthority> authorities)
      Parameters:
      key - key the key to identify tokens created by this filter
      principal - the principal which will be used to represent anonymous users
      authorities - 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 interface org.springframework.web.server.WebFilter
    • createAuthentication

      protected Authentication createAuthentication(org.springframework.web.server.ServerWebExchange exchange)