Class ServerHttpSecurity.AnonymousSpec

  • Enclosing class:
    ServerHttpSecurity

    public final class ServerHttpSecurity.AnonymousSpec
    extends java.lang.Object
    Configures anonymous authentication
    Since:
    5.2.0
    • Method Detail

      • key

        public ServerHttpSecurity.AnonymousSpec key​(java.lang.String key)
        Sets the key to identify tokens created for anonymous authentication. Default is a secure randomly generated key.
        Parameters:
        key - the key to identify tokens created for anonymous authentication. Default is a secure randomly generated key.
        Returns:
        the ServerHttpSecurity.AnonymousSpec for further customization of anonymous authentication
      • principal

        public ServerHttpSecurity.AnonymousSpec principal​(java.lang.Object principal)
        Sets the principal for Authentication objects of anonymous users
        Parameters:
        principal - used for the Authentication object of anonymous users
        Returns:
        the ServerHttpSecurity.AnonymousSpec for further customization of anonymous authentication
      • authorities

        public ServerHttpSecurity.AnonymousSpec authorities​(java.util.List<org.springframework.security.core.GrantedAuthority> authorities)
        Sets the Authentication.getAuthorities() for anonymous users
        Parameters:
        authorities - Sets the Authentication.getAuthorities() for anonymous users
        Returns:
        the ServerHttpSecurity.AnonymousSpec for further customization of anonymous authentication
      • authorities

        public ServerHttpSecurity.AnonymousSpec authorities​(java.lang.String... authorities)
        Sets the Authentication.getAuthorities() for anonymous users
        Parameters:
        authorities - Sets the Authentication.getAuthorities() for anonymous users (i.e. "ROLE_ANONYMOUS")
        Returns:
        the ServerHttpSecurity.AnonymousSpec for further customization of anonymous authentication
      • authenticationFilter

        public ServerHttpSecurity.AnonymousSpec authenticationFilter​(org.springframework.security.web.server.authentication.AnonymousAuthenticationWebFilter authenticationFilter)
        Sets the AnonymousAuthenticationWebFilter used to populate an anonymous user. If this is set, no attributes on the ServerHttpSecurity.AnonymousSpec will be set on the AnonymousAuthenticationWebFilter.
        Parameters:
        authenticationFilter - the AnonymousAuthenticationWebFilter used to populate an anonymous user.
        Returns:
        the ServerHttpSecurity.AnonymousSpec for further customization of anonymous authentication