Class VaadinStatelessSecurityConfigurer<H extends org.springframework.security.config.annotation.web.HttpSecurityBuilder<H>>
- java.lang.Object
-
- org.springframework.security.config.annotation.SecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,B>
-
- org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer<VaadinStatelessSecurityConfigurer<H>,H>
-
- com.vaadin.flow.spring.security.stateless.VaadinStatelessSecurityConfigurer<H>
-
- Type Parameters:
H- the concreteHttpSecurityBuildersubclass
- All Implemented Interfaces:
org.springframework.security.config.annotation.SecurityConfigurer<org.springframework.security.web.DefaultSecurityFilterChain,H>
public final class VaadinStatelessSecurityConfigurer<H extends org.springframework.security.config.annotation.web.HttpSecurityBuilder<H>> extends org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer<VaadinStatelessSecurityConfigurer<H>,H>
Enables authentication that relies on JWT instead of sessions.Shared Objects Created
The following shared objects are populated:SecurityContextRepositoryis populated with aJwtSecurityContextRepositoryCsrfConfigurer.csrfTokenRepository(CsrfTokenRepository)is used to setLazyCsrfTokenRepositorythat delegates toCookieCsrfTokenRepository
Shared Objects Used
The following shared objects are used:VaadinDefaultRequestCache- if present, this usesVaadinDefaultRequestCache.setDelegateRequestCache(RequestCache)to delegate saving requests toCookieRequestCache
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classVaadinStatelessSecurityConfigurer.SecretKeyConfigurerEnables configuring the secret key and the algorithm for the JWT signing and verification when usingVaadinStatelessSecurityConfigurer.
-
Constructor Summary
Constructors Constructor Description VaadinStatelessSecurityConfigurer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(H http)VaadinStatelessSecurityConfigurer<H>expiresIn(long expiresIn)Sets the lifetime of the JWT.voidinit(H http)VaadinStatelessSecurityConfigurer<H>issuer(String issuer)Sets the issuer claim to use when issuing and verifying the JWT.VaadinStatelessSecurityConfigurer.SecretKeyConfigurerwithSecretKey()Specifies using a secret key for signing and verification.VaadinStatelessSecurityConfigurer<H>withSecretKey(org.springframework.security.config.Customizer<VaadinStatelessSecurityConfigurer.SecretKeyConfigurer> customizer)Specifies using a secret key for signing and verification.-
Methods inherited from class org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
disable, withObjectPostProcessor
-
-
-
-
Method Detail
-
init
public void init(H http)
- Specified by:
initin interfaceorg.springframework.security.config.annotation.SecurityConfigurer<org.springframework.security.web.DefaultSecurityFilterChain,H extends org.springframework.security.config.annotation.web.HttpSecurityBuilder<H>>- Overrides:
initin classorg.springframework.security.config.annotation.SecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,H extends org.springframework.security.config.annotation.web.HttpSecurityBuilder<H>>
-
configure
public void configure(H http)
- Specified by:
configurein interfaceorg.springframework.security.config.annotation.SecurityConfigurer<org.springframework.security.web.DefaultSecurityFilterChain,H extends org.springframework.security.config.annotation.web.HttpSecurityBuilder<H>>- Overrides:
configurein classorg.springframework.security.config.annotation.SecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,H extends org.springframework.security.config.annotation.web.HttpSecurityBuilder<H>>
-
expiresIn
public VaadinStatelessSecurityConfigurer<H> expiresIn(long expiresIn)
Sets the lifetime of the JWT. The default is 1800 seconds.- Parameters:
expiresIn- the lifetime in seconds- Returns:
- the
VaadinStatelessSecurityConfigurerfor further customization
-
issuer
public VaadinStatelessSecurityConfigurer<H> issuer(String issuer)
Sets the issuer claim to use when issuing and verifying the JWT.- Parameters:
issuer- string identifier or URL of the issuer- Returns:
- the
VaadinStatelessSecurityConfigurerfor further customization
-
withSecretKey
public VaadinStatelessSecurityConfigurer.SecretKeyConfigurer withSecretKey()
Specifies using a secret key for signing and verification.
-
withSecretKey
public VaadinStatelessSecurityConfigurer<H> withSecretKey(org.springframework.security.config.Customizer<VaadinStatelessSecurityConfigurer.SecretKeyConfigurer> customizer)
Specifies using a secret key for signing and verification.- Parameters:
customizer- theCustomizerto provide configuration for theVaadinStatelessSecurityConfigurer.SecretKeyConfigurer- Returns:
- the
VaadinStatelessSecurityConfigurerfor further customization
-
-