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 Token
  • JwtIssuerValidator - Validates the iss claim header
  • FirebaseTokenValidator - Validates all other headers according to definition at https://firebase.google.com/docs/auth/admin/verify-id-tokens
Since:
1.2.2
  • Constructor Summary

    Constructors
    Constructor
    Description
    FirebaseJwtTokenDecoder(org.springframework.web.client.RestOperations restClient, String googlePublicKeysEndpoint, org.springframework.security.oauth2.core.OAuth2TokenValidator<org.springframework.security.oauth2.jwt.Jwt> tokenValidator)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.oauth2.jwt.Jwt
    decode(String token)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 interface org.springframework.security.oauth2.jwt.JwtDecoder
      Throws:
      org.springframework.security.oauth2.jwt.JwtException