Class: Rack::Firebase::TokenDecoder
- Inherits:
-
Object
- Object
- Rack::Firebase::TokenDecoder
- Defined in:
- lib/rack/firebase/token_decoder.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#jwt_loader ⇒ Object
Returns the value of attribute jwt_loader.
Instance Method Summary collapse
- #call(token) ⇒ Object
- #firebase_issuers ⇒ Object
-
#initialize ⇒ TokenDecoder
constructor
A new instance of TokenDecoder.
Constructor Details
#initialize ⇒ TokenDecoder
Returns a new instance of TokenDecoder.
10 11 12 13 |
# File 'lib/rack/firebase/token_decoder.rb', line 10 def initialize @jwt_loader = FIREBASE_KEY_LOADER @config = Rack::Firebase.configuration end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
8 9 10 |
# File 'lib/rack/firebase/token_decoder.rb', line 8 def config @config end |
#jwt_loader ⇒ Object
Returns the value of attribute jwt_loader.
8 9 10 |
# File 'lib/rack/firebase/token_decoder.rb', line 8 def jwt_loader @jwt_loader end |
Instance Method Details
#call(token) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rack/firebase/token_decoder.rb', line 15 def call(token) JWT.decode( token, nil, true, { jwks: jwt_loader, algorithm: ALG, verify_iat: true, verify_aud: true, aud: config.project_ids, verify_iss: true, iss: firebase_issuers } )[0] end |
#firebase_issuers ⇒ Object
28 29 30 31 32 |
# File 'lib/rack/firebase/token_decoder.rb', line 28 def firebase_issuers config.project_ids.map { |project_id| "https://securetoken.google.com/#{project_id}" } end |