Class: FirebaseTokenAuthentication::AccessToken
- Inherits:
-
Object
- Object
- FirebaseTokenAuthentication::AccessToken
- Defined in:
- lib/firebase_token_authentication/access_token.rb
Constant Summary collapse
- DECODE_OPTIONS =
{ algorithm: "RS256", verify_iat: true, verify_aud: true, verify_iss: true }.freeze
Instance Attribute Summary collapse
-
#certificate ⇒ Object
readonly
Returns the value of attribute certificate.
-
#firebase_token ⇒ Object
readonly
Returns the value of attribute firebase_token.
-
#key_id ⇒ Object
readonly
Returns the value of attribute key_id.
Instance Method Summary collapse
-
#initialize(firebase_token, certificate = GoogleX509Certificate.new) ⇒ AccessToken
constructor
A new instance of AccessToken.
- #verify ⇒ Object
Constructor Details
#initialize(firebase_token, certificate = GoogleX509Certificate.new) ⇒ AccessToken
Returns a new instance of AccessToken.
16 17 18 19 20 |
# File 'lib/firebase_token_authentication/access_token.rb', line 16 def initialize(firebase_token, certificate = GoogleX509Certificate.new) @firebase_token = firebase_token @certificate = certificate @key_id = decode(key: nil, verify_key: false)[1]["kid"] end |
Instance Attribute Details
#certificate ⇒ Object (readonly)
Returns the value of attribute certificate.
7 8 9 |
# File 'lib/firebase_token_authentication/access_token.rb', line 7 def certificate @certificate end |
#firebase_token ⇒ Object (readonly)
Returns the value of attribute firebase_token.
7 8 9 |
# File 'lib/firebase_token_authentication/access_token.rb', line 7 def firebase_token @firebase_token end |
#key_id ⇒ Object (readonly)
Returns the value of attribute key_id.
7 8 9 |
# File 'lib/firebase_token_authentication/access_token.rb', line 7 def key_id @key_id end |
Instance Method Details
#verify ⇒ Object
22 23 24 |
# File 'lib/firebase_token_authentication/access_token.rb', line 22 def verify decode(key: certificate.find(key_id)) end |