Class: Himari::SessionData
- Inherits:
-
Object
- Object
- Himari::SessionData
- Includes:
- TokenString
- Defined in:
- lib/himari/session_data.rb
Instance Attribute Summary collapse
-
#claims ⇒ Object
readonly
Returns the value of attribute claims.
-
#user_data ⇒ Object
readonly
Returns the value of attribute user_data.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
- #as_log ⇒ Object
-
#initialize(claims: {}, user_data: {}, handle:, secret: nil, secret_hash: nil, expiry: nil) ⇒ SessionData
constructor
A new instance of SessionData.
Methods included from TokenString
#expiry, #format, #handle, included, #magic_header, #secret, #secret_hash, #verify!, #verify_expiry!, #verify_secret!
Constructor Details
#initialize(claims: {}, user_data: {}, handle:, secret: nil, secret_hash: nil, expiry: nil) ⇒ SessionData
Returns a new instance of SessionData.
7 8 9 10 11 12 13 14 15 |
# File 'lib/himari/session_data.rb', line 7 def initialize(claims: {}, user_data: {}, handle:, secret: nil, secret_hash: nil, expiry: nil) @claims = claims @user_data = user_data @handle = handle @secret = secret @secret_hash = secret_hash @expiry = expiry end |
Instance Attribute Details
#claims ⇒ Object (readonly)
Returns the value of attribute claims.
25 26 27 |
# File 'lib/himari/session_data.rb', line 25 def claims @claims end |
#user_data ⇒ Object (readonly)
Returns the value of attribute user_data.
25 26 27 |
# File 'lib/himari/session_data.rb', line 25 def user_data @user_data end |
Class Method Details
.default_lifetime ⇒ Object
21 22 23 |
# File 'lib/himari/session_data.rb', line 21 def self.default_lifetime 3600 end |
.magic_header ⇒ Object
17 18 19 |
# File 'lib/himari/session_data.rb', line 17 def self.magic_header 'hmas' end |
Instance Method Details
#as_json ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/himari/session_data.rb', line 35 def as_json { handle: handle, secret_hash: secret_hash, expiry: expiry, claims: claims, user_data: user_data, } end |
#as_log ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/himari/session_data.rb', line 27 def as_log { handle: handle, claims: claims, expiry: expiry, } end |