Class ServerHttpSecurity.AnonymousSpec
- java.lang.Object
-
- org.springframework.security.config.web.server.ServerHttpSecurity.AnonymousSpec
-
- Enclosing class:
- ServerHttpSecurity
public final class ServerHttpSecurity.AnonymousSpec extends java.lang.Object
Configures anonymous authentication- Since:
- 5.2.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerHttpSecurity
and()
Allows method chaining to continue configuring theServerHttpSecurity
ServerHttpSecurity.AnonymousSpec
authenticationFilter(AnonymousAuthenticationWebFilter authenticationFilter)
Sets theAnonymousAuthenticationWebFilter
used to populate an anonymous user.ServerHttpSecurity.AnonymousSpec
authorities(java.lang.String... authorities)
Sets theAuthentication.getAuthorities()
for anonymous usersServerHttpSecurity.AnonymousSpec
authorities(java.util.List<GrantedAuthority> authorities)
Sets theAuthentication.getAuthorities()
for anonymous usersprotected void
configure(ServerHttpSecurity http)
ServerHttpSecurity
disable()
Disables anonymous authentication.ServerHttpSecurity.AnonymousSpec
key(java.lang.String key)
Sets the key to identify tokens created for anonymous authentication.ServerHttpSecurity.AnonymousSpec
principal(java.lang.Object principal)
Sets the principal forAuthentication
objects of anonymous users
-
-
-
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 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
public ServerHttpSecurity.AnonymousSpec authorities(java.util.List<GrantedAuthority> 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
public ServerHttpSecurity.AnonymousSpec authorities(java.lang.String... 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
public ServerHttpSecurity and()
Allows method chaining to continue configuring theServerHttpSecurity
- 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)
-
-