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 Summary
Modifier 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
-
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.AnonymousSpecfor further customization of anonymous authentication
-
principal
Sets the principal forAuthenticationobjects of anonymous users- Parameters:
principal- used for theAuthenticationobject of anonymous users- Returns:
- the
ServerHttpSecurity.AnonymousSpecfor further customization of anonymous authentication
-
authorities
Sets theAuthentication.getAuthorities()for anonymous users- Parameters:
authorities- Sets theAuthentication.getAuthorities()for anonymous users- Returns:
- the
ServerHttpSecurity.AnonymousSpecfor further customization of anonymous authentication
-
authorities
Sets theAuthentication.getAuthorities()for anonymous users- Parameters:
authorities- Sets theAuthentication.getAuthorities()for anonymous users (i.e. "ROLE_ANONYMOUS")- Returns:
- the
ServerHttpSecurity.AnonymousSpecfor further customization of anonymous authentication
-
authenticationFilter
public 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- theAnonymousAuthenticationWebFilterused to populate an anonymous user.- Returns:
- the
ServerHttpSecurity.AnonymousSpecfor further customization of anonymous authentication
-
and
Deprecated, 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
-
disable
Disables anonymous authentication.- Returns:
- the
ServerHttpSecurityto continue configuring
-
configure
-