Class: IesAuth::Token
- Inherits:
-
Object
- Object
- IesAuth::Token
- Defined in:
- lib/ies_auth/model/token.rb
Overview
Usage example = Token.new example.build(message)
Instance Attribute Summary collapse
- #client ⇒ Object
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#enc ⇒ Object
readonly
Returns the value of attribute enc.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
- #algorithm ⇒ Object
- #expiration ⇒ Object
- #hcc ⇒ Object
-
#initialize(data) ⇒ Token
constructor
A new instance of Token.
- #issued_at ⇒ Object
- #kid ⇒ Object
- #session_id ⇒ Object
- #sub ⇒ Object
- #type ⇒ Object
- #user_id ⇒ Object
Constructor Details
#initialize(data) ⇒ Token
Returns a new instance of Token.
9 10 11 12 |
# File 'lib/ies_auth/model/token.rb', line 9 def initialize(data) @data = data @session, @enc = JWT.decode(data, nil, false, { algorithm: 'RS512' }) end |
Instance Attribute Details
#client ⇒ Object
18 19 20 |
# File 'lib/ies_auth/model/token.rb', line 18 def client @client ||= "ies_auth" end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/ies_auth/model/token.rb', line 7 def data @data end |
#enc ⇒ Object (readonly)
Returns the value of attribute enc.
7 8 9 |
# File 'lib/ies_auth/model/token.rb', line 7 def enc @enc end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
7 8 9 |
# File 'lib/ies_auth/model/token.rb', line 7 def session @session end |
Instance Method Details
#algorithm ⇒ Object
14 15 16 |
# File 'lib/ies_auth/model/token.rb', line 14 def algorithm enc["alg"] end |
#expiration ⇒ Object
22 23 24 |
# File 'lib/ies_auth/model/token.rb', line 22 def expiration Time.at(session["exp"]) end |
#hcc ⇒ Object
26 27 28 |
# File 'lib/ies_auth/model/token.rb', line 26 def hcc session["hcc"] end |
#issued_at ⇒ Object
30 31 32 |
# File 'lib/ies_auth/model/token.rb', line 30 def issued_at Time.at(session["iat"]) end |
#kid ⇒ Object
34 35 36 |
# File 'lib/ies_auth/model/token.rb', line 34 def kid enc["kid"] end |
#session_id ⇒ Object
38 39 40 |
# File 'lib/ies_auth/model/token.rb', line 38 def session_id session["sessid"] end |
#sub ⇒ Object
42 43 44 |
# File 'lib/ies_auth/model/token.rb', line 42 def sub session["sub"] end |
#type ⇒ Object
46 47 48 |
# File 'lib/ies_auth/model/token.rb', line 46 def type session["type"] end |
#user_id ⇒ Object
50 51 52 |
# File 'lib/ies_auth/model/token.rb', line 50 def user_id sub end |