Class ServerHttpSecurity.AnonymousSpec

java.lang.Object
org.springframework.security.config.web.server.ServerHttpSecurity.AnonymousSpec
Enclosing class:
ServerHttpSecurity

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

    • 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(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(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(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
    • and

      public ServerHttpSecurity and()
      Allows method chaining to continue configuring the ServerHttpSecurity
      Returns:
      the ServerHttpSecurity to continue configuring
    • disable

      public ServerHttpSecurity disable()
      Disables anonymous authentication.
      Returns:
      the ServerHttpSecurity to continue configuring
    • configure

      protected void configure(ServerHttpSecurity http)