Class: SsoOauthToken
- Inherits:
-
Object
- Object
- SsoOauthToken
- Defined in:
- lib/app/models/sso_oauth_token.rb
Overview
OAuth 2.0 Token
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#expiry ⇒ Object
Returns the value of attribute expiry.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
-
#token_type ⇒ Object
Returns the value of attribute token_type.
Instance Method Summary collapse
-
#authorization ⇒ Object
abstract
String.
- #type ⇒ Object
- #valid? ⇒ Boolean
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
7 8 9 |
# File 'lib/app/models/sso_oauth_token.rb', line 7 def access_token @access_token end |
#expiry ⇒ Object
Returns the value of attribute expiry.
7 8 9 |
# File 'lib/app/models/sso_oauth_token.rb', line 7 def expiry @expiry end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
7 8 9 |
# File 'lib/app/models/sso_oauth_token.rb', line 7 def refresh_token @refresh_token end |
#token_type ⇒ Object
Returns the value of attribute token_type.
7 8 9 |
# File 'lib/app/models/sso_oauth_token.rb', line 7 def token_type @token_type end |
Instance Method Details
#authorization ⇒ Object
This method is abstract.
The authorization string for this token type
Returns String.
11 12 13 |
# File 'lib/app/models/sso_oauth_token.rb', line 11 def [type, access_token].compact.join(' ') end |
#type ⇒ Object
15 16 17 |
# File 'lib/app/models/sso_oauth_token.rb', line 15 def type @token_type.presence || 'Bearer' end |
#valid? ⇒ Boolean
19 20 21 |
# File 'lib/app/models/sso_oauth_token.rb', line 19 def valid? @access_token.present? && (@expiry.nil? || Time.now.utc < @expiry) end |