Class ServerHttpSecurity.AnonymousSpec
java.lang.Object
org.springframework.security.config.web.server.ServerHttpSecurity.AnonymousSpec
- Enclosing class:
- ServerHttpSecurity
Configures anonymous authentication
- Since:
- 5.2.0
- 
Method SummaryModifier and TypeMethodDescriptionand()Deprecated, for removal: This API element is subject to removal in a future version.For removal in 7.0.authenticationFilter(AnonymousAuthenticationWebFilter authenticationFilter) Sets theAnonymousAuthenticationWebFilterused to populate an anonymous user.authorities(String... authorities) Sets theAuthentication.getAuthorities()for anonymous usersauthorities(List<GrantedAuthority> authorities) Sets theAuthentication.getAuthorities()for anonymous usersprotected voidconfigure(ServerHttpSecurity http) disable()Disables anonymous authentication.Sets the key to identify tokens created for anonymous authentication.Sets the principal forAuthenticationobjects of anonymous users
- 
Method Details- 
keySets 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.AnonymousSpecfor further customization of anonymous authentication
 
- 
principalSets the principal forAuthenticationobjects of anonymous users- Parameters:
- principal- used for the- Authenticationobject of anonymous users
- Returns:
- the ServerHttpSecurity.AnonymousSpecfor further customization of anonymous authentication
 
- 
authoritiesSets theAuthentication.getAuthorities()for anonymous users- Parameters:
- authorities- Sets the- Authentication.getAuthorities()for anonymous users
- Returns:
- the ServerHttpSecurity.AnonymousSpecfor further customization of anonymous authentication
 
- 
authoritiesSets theAuthentication.getAuthorities()for anonymous users- Parameters:
- authorities- Sets the- Authentication.getAuthorities()for anonymous users (i.e. "ROLE_ANONYMOUS")
- Returns:
- the ServerHttpSecurity.AnonymousSpecfor further customization of anonymous authentication
 
- 
authenticationFilterpublic ServerHttpSecurity.AnonymousSpec authenticationFilter(AnonymousAuthenticationWebFilter authenticationFilter) Sets theAnonymousAuthenticationWebFilterused to populate an anonymous user. If this is set, no attributes on theServerHttpSecurity.AnonymousSpecwill be set on theAnonymousAuthenticationWebFilter.- Parameters:
- authenticationFilter- the- AnonymousAuthenticationWebFilterused to populate an anonymous user.
- Returns:
- the ServerHttpSecurity.AnonymousSpecfor further customization of anonymous authentication
 
- 
andDeprecated, for removal: This API element is subject to removal in a future version.For removal in 7.0. UseServerHttpSecurity.anonymous(Customizer)oranonymous(Customizer.withDefaults())to stick with defaults. See the documentation for more details.Allows method chaining to continue configuring theServerHttpSecurity- Returns:
- the ServerHttpSecurityto continue configuring
 
- 
disableDisables anonymous authentication.- Returns:
- the ServerHttpSecurityto continue configuring
 
- 
configure
 
-