Class: Core::Models::OAuth::RefreshToken
- Inherits:
-
Object
- Object
- Core::Models::OAuth::RefreshToken
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/core/models/oauth/refresh_token.rb
Overview
A refresh token is used when an access token is expired, to get a new one. It is then recreated for the next expiration.
Instance Attribute Summary collapse
-
#authorization ⇒ Core::Models::OAuth::Authorization
The authorization code that issued this token to the application for this user.
-
#used_at ⇒ DateTime
The date and time at which this refresh token has been useds to create a new access token.
-
#value ⇒ String
The value of the token, returned to the application when built.
Instance Method Summary collapse
Instance Attribute Details
#authorization ⇒ Core::Models::OAuth::Authorization
Returns the authorization code that issued this token to the application for this user.
21 |
# File 'lib/core/models/oauth/refresh_token.rb', line 21 belongs_to :token, class_name: 'Core::Models::OAuth::AccessToken', inverse_of: :refresh_token |
#used_at ⇒ DateTime
Returns the date and time at which this refresh token has been useds to create a new access token.
17 |
# File 'lib/core/models/oauth/refresh_token.rb', line 17 field :used_at, type: DateTime, default: nil |
#value ⇒ String
Returns the value of the token, returned to the application when built.
14 |
# File 'lib/core/models/oauth/refresh_token.rb', line 14 field :value, type: String, default: ->{ SecureRandom.hex } |
Instance Method Details
#used? ⇒ Boolean
23 24 25 |
# File 'lib/core/models/oauth/refresh_token.rb', line 23 def used? !used_at.nil? && used_at < DateTime.now end |