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 theAnonymousAuthenticationWebFilter
used to populate an anonymous user.authorities
(String... authorities) Sets theAuthentication.getAuthorities()
for anonymous usersauthorities
(List<GrantedAuthority> authorities) Sets theAuthentication.getAuthorities()
for anonymous usersprotected void
configure
(ServerHttpSecurity http) disable()
Disables anonymous authentication.Sets the key to identify tokens created for anonymous authentication.Sets the principal forAuthentication
objects 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.AnonymousSpec
for further customization of anonymous authentication
-
principal
Sets the principal forAuthentication
objects of anonymous users- Parameters:
principal
- used for theAuthentication
object of anonymous users- Returns:
- the
ServerHttpSecurity.AnonymousSpec
for further customization of anonymous authentication
-
authorities
Sets theAuthentication.getAuthorities()
for anonymous users- Parameters:
authorities
- Sets theAuthentication.getAuthorities()
for anonymous users- Returns:
- the
ServerHttpSecurity.AnonymousSpec
for 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.AnonymousSpec
for further customization of anonymous authentication
-
authenticationFilter
public ServerHttpSecurity.AnonymousSpec authenticationFilter(AnonymousAuthenticationWebFilter authenticationFilter) Sets theAnonymousAuthenticationWebFilter
used to populate an anonymous user. If this is set, no attributes on theServerHttpSecurity.AnonymousSpec
will be set on theAnonymousAuthenticationWebFilter
.- Parameters:
authenticationFilter
- theAnonymousAuthenticationWebFilter
used to populate an anonymous user.- Returns:
- the
ServerHttpSecurity.AnonymousSpec
for 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
ServerHttpSecurity
to continue configuring
-
disable
Disables anonymous authentication.- Returns:
- the
ServerHttpSecurity
to continue configuring
-
configure
-