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.HttpSecurityconfigure(org.springframework.security.config.annotation.web.builders.HttpSecurity http)Further configure theHttpSecurityobject with some sensible defaults by registering objects to obtain a bearer token from a request.static JwtWebSecurityConfigurerConfigures application authorization for JWT signed with HS256static JwtWebSecurityConfigurerforHS256(String audience, String[] issuers, org.springframework.security.authentication.AuthenticationProvider provider)Configures application authorization for JWT signed with HS256static JwtWebSecurityConfigurerConfigures application authorization for JWT signed with HS256static JwtWebSecurityConfigurerforHS256(String audience, String issuer, org.springframework.security.authentication.AuthenticationProvider provider)Configures application authorization for JWT signed with HS256static JwtWebSecurityConfigurerforHS256WithBase64Secret(String audience, String[] issuers, String secret)Configures application authorization for JWT signed with HS256static JwtWebSecurityConfigurerforHS256WithBase64Secret(String audience, String issuer, String secret)Configures application authorization for JWT signed with HS256static JwtWebSecurityConfigurerConfigures application authorization for JWT signed with RS256.static JwtWebSecurityConfigurerConfigures application authorization for JWT signed with RS256.static JwtWebSecurityConfigurerforRS256(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 ofkidof the JWT headerstatic JwtWebSecurityConfigurerforRS256(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 ofkidof 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 ofkidof the JWT header- Parameters:
audience- identifier of the API and must match theaudvalue in the tokenissuer- of the token for this API and must match theissvalue 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 ofkidof the JWT header- Parameters:
audience- identifier of the API and must match theaudvalue in the tokenissuer- of the token for this API and must match theissvalue 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 ofkidof the JWT header- Parameters:
audience- identifier of the API and must match theaudvalue in the tokenissuers- array of allowed issuers of the token for this API and one of the entries must match theissvalue 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 ofkidof the JWT header- Parameters:
audience- identifier of the API and must match theaudvalue in the tokenissuers- array of allowed issuers of the token for this API and one of the entries must match theissvalue 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 theaudvalue in the tokenissuer- of the token for this API and must match theissvalue 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 theaudvalue in the tokenissuer- of the token for this API and must match theissvalue 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 theaudvalue in the tokenissuer- of the token for this API and must match theissvalue 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 theaudvalue in the tokenissuers- array of allowed issuers of the token for this API and one of the entries must match theissvalue 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 theaudvalue in the tokenissuers- array of allowed issuers of the token for this API and one of the entries must match theissvalue 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 theaudvalue in the tokenissuers- list of allowed issuers of the token for this API and one of the entries must match theissvalue 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 ExceptionFurther configure theHttpSecurityobject 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
-