Class FirebaseJwtTokenDecoder
java.lang.Object
com.google.cloud.spring.security.firebase.FirebaseJwtTokenDecoder
- All Implemented Interfaces:
org.springframework.security.oauth2.jwt.JwtDecoder
public class FirebaseJwtTokenDecoder
extends Object
implements org.springframework.security.oauth2.jwt.JwtDecoder
Decodes a Firebase token into a
Jwt
token. This decoder downloads public keys from
https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com. Keys
are rotated often, and expiration date is returned as part of a Cache-Control max-age header. The
keys are cached locally and only refreshed when the expiration time is past. Besides using the
RSA keys to validate the token signature, this decoder also uses a pre=configured DelegatingOAuth2TokenValidator
to validate all the
claims. The following validators are used by this class:
JwtTimestampValidator
- Validates the expiration date of the TokenJwtIssuerValidator
- Validates the iss claim headerFirebaseTokenValidator
- Validates all other headers according to definition at https://firebase.google.com/docs/auth/admin/verify-id-tokens
- Since:
- 1.2.2
-
Constructor Summary
ConstructorDescriptionFirebaseJwtTokenDecoder
(org.springframework.web.client.RestOperations restClient, String googlePublicKeysEndpoint, org.springframework.security.oauth2.core.OAuth2TokenValidator<org.springframework.security.oauth2.jwt.Jwt> tokenValidator) -
Method Summary
-
Constructor Details
-
FirebaseJwtTokenDecoder
public FirebaseJwtTokenDecoder(org.springframework.web.client.RestOperations restClient, String googlePublicKeysEndpoint, org.springframework.security.oauth2.core.OAuth2TokenValidator<org.springframework.security.oauth2.jwt.Jwt> tokenValidator)
-
-
Method Details
-
decode
public org.springframework.security.oauth2.jwt.Jwt decode(String token) throws org.springframework.security.oauth2.jwt.JwtException - Specified by:
decode
in interfaceorg.springframework.security.oauth2.jwt.JwtDecoder
- Throws:
org.springframework.security.oauth2.jwt.JwtException
-