Package com.auth0.spring.security.api
Class JwtWebSecurityConfigurer
java.lang.Object
com.auth0.spring.security.api.JwtWebSecurityConfigurer
Utility class for configuring Security for your Spring API
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.config.annotation.web.builders.HttpSecurity
configure
(org.springframework.security.config.annotation.web.builders.HttpSecurity http) Further configure theHttpSecurity
object with some sensible defaults by registering objects to obtain a bearer token from a request.static JwtWebSecurityConfigurer
Configures application authorization for JWT signed with HS256static JwtWebSecurityConfigurer
forHS256
(String audience, String[] issuers, org.springframework.security.authentication.AuthenticationProvider provider) Configures application authorization for JWT signed with HS256static JwtWebSecurityConfigurer
Configures application authorization for JWT signed with HS256static JwtWebSecurityConfigurer
forHS256
(String audience, String issuer, org.springframework.security.authentication.AuthenticationProvider provider) Configures application authorization for JWT signed with HS256static JwtWebSecurityConfigurer
forHS256WithBase64Secret
(String audience, String[] issuers, String secret) Configures application authorization for JWT signed with HS256static JwtWebSecurityConfigurer
forHS256WithBase64Secret
(String audience, String issuer, String secret) Configures application authorization for JWT signed with HS256static JwtWebSecurityConfigurer
Configures application authorization for JWT signed with RS256.static JwtWebSecurityConfigurer
Configures application authorization for JWT signed with RS256.static JwtWebSecurityConfigurer
forRS256
(String audience, String[] issuers, org.springframework.security.authentication.AuthenticationProvider provider) Configures application authorization for JWT signed with RS256 Will try to validate the token using the public key downloaded from "$issuer/.well-known/jwks.json" and matched by the value ofkid
of the JWT headerstatic JwtWebSecurityConfigurer
forRS256
(String audience, String issuer, org.springframework.security.authentication.AuthenticationProvider provider) Configures application authorization for JWT signed with RS256 Will try to validate the token using the public key downloaded from "$issuer/.well-known/jwks.json" and matched by the value ofkid
of the JWT header
-
Method Details
-
forRS256
Configures application authorization for JWT signed with RS256. Will try to validate the token using the public key downloaded from "$issuer/.well-known/jwks.json" and matched by the value ofkid
of the JWT header- Parameters:
audience
- identifier of the API and must match theaud
value in the tokenissuer
- of the token for this API and must match theiss
value in the token- Returns:
- JwtWebSecurityConfigurer for further configuration
-
forRS256
public static JwtWebSecurityConfigurer forRS256(String audience, String issuer, org.springframework.security.authentication.AuthenticationProvider provider) Configures application authorization for JWT signed with RS256 Will try to validate the token using the public key downloaded from "$issuer/.well-known/jwks.json" and matched by the value ofkid
of the JWT header- Parameters:
audience
- identifier of the API and must match theaud
value in the tokenissuer
- of the token for this API and must match theiss
value in the tokenprovider
- of Spring Authentication objects that can validate aPreAuthenticatedAuthenticationJsonWebToken
- Returns:
- JwtWebSecurityConfigurer for further configuration
-
forRS256
Configures application authorization for JWT signed with RS256. Will try to validate the token using the public key downloaded from "$issuer/.well-known/jwks.json" and matched by the value ofkid
of the JWT header- Parameters:
audience
- identifier of the API and must match theaud
value in the tokenissuers
- array of allowed issuers of the token for this API and one of the entries must match theiss
value in the token- Returns:
- JwtWebSecurityConfigurer for further configuration
-
forRS256
public static JwtWebSecurityConfigurer forRS256(String audience, String[] issuers, org.springframework.security.authentication.AuthenticationProvider provider) Configures application authorization for JWT signed with RS256 Will try to validate the token using the public key downloaded from "$issuer/.well-known/jwks.json" and matched by the value ofkid
of the JWT header- Parameters:
audience
- identifier of the API and must match theaud
value in the tokenissuers
- array of allowed issuers of the token for this API and one of the entries must match theiss
value in the tokenprovider
- of Spring Authentication objects that can validate aPreAuthenticatedAuthenticationJsonWebToken
- Returns:
- JwtWebSecurityConfigurer for further configuration
-
forHS256WithBase64Secret
public static JwtWebSecurityConfigurer forHS256WithBase64Secret(String audience, String issuer, String secret) Configures application authorization for JWT signed with HS256- Parameters:
audience
- identifier of the API and must match theaud
value in the tokenissuer
- of the token for this API and must match theiss
value in the tokensecret
- used to sign and verify tokens encoded in Base64- Returns:
- JwtWebSecurityConfigurer for further configuration
-
forHS256
Configures application authorization for JWT signed with HS256- Parameters:
audience
- identifier of the API and must match theaud
value in the tokenissuer
- of the token for this API and must match theiss
value in the tokensecret
- used to sign and verify tokens- Returns:
- JwtWebSecurityConfigurer for further configuration
-
forHS256
public static JwtWebSecurityConfigurer forHS256(String audience, String issuer, org.springframework.security.authentication.AuthenticationProvider provider) Configures application authorization for JWT signed with HS256- Parameters:
audience
- identifier of the API and must match theaud
value in the tokenissuer
- of the token for this API and must match theiss
value in the tokenprovider
- of Spring Authentication objects that can validate aPreAuthenticatedAuthenticationJsonWebToken
- Returns:
- JwtWebSecurityConfigurer for further configuration
-
forHS256WithBase64Secret
public static JwtWebSecurityConfigurer forHS256WithBase64Secret(String audience, String[] issuers, String secret) Configures application authorization for JWT signed with HS256- Parameters:
audience
- identifier of the API and must match theaud
value in the tokenissuers
- array of allowed issuers of the token for this API and one of the entries must match theiss
value in the tokensecret
- used to sign and verify tokens encoded in Base64- Returns:
- JwtWebSecurityConfigurer for further configuration
-
forHS256
Configures application authorization for JWT signed with HS256- Parameters:
audience
- identifier of the API and must match theaud
value in the tokenissuers
- array of allowed issuers of the token for this API and one of the entries must match theiss
value in the tokensecret
- used to sign and verify tokens- Returns:
- JwtWebSecurityConfigurer for further configuration
-
forHS256
public static JwtWebSecurityConfigurer forHS256(String audience, String[] issuers, org.springframework.security.authentication.AuthenticationProvider provider) Configures application authorization for JWT signed with HS256- Parameters:
audience
- identifier of the API and must match theaud
value in the tokenissuers
- list of allowed issuers of the token for this API and one of the entries must match theiss
value in the tokenprovider
- of Spring Authentication objects that can validate aPreAuthenticatedAuthenticationJsonWebToken
- Returns:
- JwtWebSecurityConfigurer for further configuration
-
configure
public org.springframework.security.config.annotation.web.builders.HttpSecurity configure(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws Exception Further configure theHttpSecurity
object with some sensible defaults by registering objects to obtain a bearer token from a request.- Parameters:
http
- configuration for Spring- Returns:
- the http configuration for further customizations
- Throws:
Exception
-