Class: Compeon::Token::Decoder
- Inherits:
-
Object
- Object
- Compeon::Token::Decoder
- Defined in:
- lib/compeon/token/decoder.rb
Instance Method Summary collapse
- #decode ⇒ Object
-
#initialize(claim_verifications: {}, encoded_token:, key:, token_klass:) ⇒ Decoder
constructor
A new instance of Decoder.
Constructor Details
#initialize(claim_verifications: {}, encoded_token:, key:, token_klass:) ⇒ Decoder
Returns a new instance of Decoder.
10 11 12 13 14 15 |
# File 'lib/compeon/token/decoder.rb', line 10 def initialize(claim_verifications: {}, encoded_token:, key:, token_klass:) @claim_verifications = claim_verifications @encoded_token = encoded_token @key = key @token_klass = token_klass end |
Instance Method Details
#decode ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/compeon/token/decoder.rb', line 17 def decode raise DecodeError if decoded_token[:knd] != token_klass.kind attributes = decoded_token_attributes attributes.delete(:knd) token_klass.new(attributes) end |