Class: Userbin::SessionToken
- Inherits:
-
Object
- Object
- Userbin::SessionToken
- Defined in:
- lib/userbin/session_token.rb
Instance Method Summary collapse
- #device_trusted? ⇒ Boolean
- #expired? ⇒ Boolean
- #has_default_pairing? ⇒ Boolean
-
#initialize(token) ⇒ SessionToken
constructor
A new instance of SessionToken.
- #mfa_enabled? ⇒ Boolean
- #mfa_in_progress? ⇒ Boolean
- #mfa_required? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(token) ⇒ SessionToken
Returns a new instance of SessionToken.
5 6 7 8 9 |
# File 'lib/userbin/session_token.rb', line 5 def initialize(token) if token @jwt = Userbin::JWT.new(token) end end |
Instance Method Details
#device_trusted? ⇒ Boolean
19 20 21 |
# File 'lib/userbin/session_token.rb', line 19 def device_trusted? @jwt.payload['tru'] == 1 end |
#expired? ⇒ Boolean
15 16 17 |
# File 'lib/userbin/session_token.rb', line 15 def expired? @jwt.expired? end |
#has_default_pairing? ⇒ Boolean
23 24 25 |
# File 'lib/userbin/session_token.rb', line 23 def has_default_pairing? @jwt.payload['dpr'] > 0 end |
#mfa_enabled? ⇒ Boolean
27 28 29 |
# File 'lib/userbin/session_token.rb', line 27 def mfa_enabled? @jwt.payload['mfa'] == 1 end |
#mfa_in_progress? ⇒ Boolean
31 32 33 |
# File 'lib/userbin/session_token.rb', line 31 def mfa_in_progress? @jwt.payload['chg'] == 1 end |
#mfa_required? ⇒ Boolean
35 36 37 |
# File 'lib/userbin/session_token.rb', line 35 def mfa_required? @jwt.payload['vfy'] > 0 end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/userbin/session_token.rb', line 11 def to_s @jwt.to_token end |