Class AnonymousAuthenticationWebFilter

  • All Implemented Interfaces:
    org.springframework.web.server.WebFilter

    public class AnonymousAuthenticationWebFilter
    extends java.lang.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected Authentication createAuthentication​(org.springframework.web.server.ServerWebExchange exchange)  
      reactor.core.publisher.Mono<java.lang.Void> filter​(org.springframework.web.server.ServerWebExchange exchange, org.springframework.web.server.WebFilterChain chain)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AnonymousAuthenticationWebFilter

        public AnonymousAuthenticationWebFilter​(java.lang.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​(java.lang.String key,
                                                java.lang.Object principal,
                                                java.util.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 Detail

      • filter

        public reactor.core.publisher.Mono<java.lang.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)