Class: Toktok::Token
- Inherits:
-
Object
- Object
- Toktok::Token
- Defined in:
- lib/toktok/token.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#jwt ⇒ Object
readonly
Returns the value of attribute jwt.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Instance Method Summary collapse
- #identity ⇒ Object
-
#initialize(identity: nil, jwt: nil, payload: nil) ⇒ Token
constructor
A new instance of Token.
Constructor Details
#initialize(identity: nil, jwt: nil, payload: nil) ⇒ Token
Returns a new instance of Token.
10 11 12 13 14 15 16 17 18 |
# File 'lib/toktok/token.rb', line 10 def initialize(identity: nil, jwt: nil, payload: nil) @config = Toktok.config @payload = {} if jwt initialize_decode(jwt, identity) else initialize_encode(identity, payload) end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/toktok/token.rb', line 8 def config @config end |
#jwt ⇒ Object (readonly)
Returns the value of attribute jwt.
8 9 10 |
# File 'lib/toktok/token.rb', line 8 def jwt @jwt end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
8 9 10 |
# File 'lib/toktok/token.rb', line 8 def payload @payload end |
Instance Method Details
#identity ⇒ Object
20 21 22 |
# File 'lib/toktok/token.rb', line 20 def identity payload[:sub] end |