Class: Core::Models::OAuth::AccessToken
- Inherits:
-
Object
- Object
- Core::Models::OAuth::AccessToken
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/core/models/oauth/access_token.rb
Overview
An access token is the value assigned to the application to access the data the user is allowed to access.
Instance Attribute Summary collapse
-
#authorization ⇒ Core::Models::OAuth::Authorization
The authorization code that issued this token to the application for this user.
-
#generated ⇒ Core::Models::OAuth::AccessToken
The token that has been generated by the current one.
-
#generator ⇒ Core::Models::Oauth::AccessToken
The token that generated this one.
-
#value ⇒ String
The value of the token, returned to the application when built.
Instance Method Summary collapse
- #premium ⇒ Object
-
#scopes ⇒ Array<Core::Models::OAuth::Scope>
Returns the scopes this access token can use to access the application.
Instance Attribute Details
#authorization ⇒ Core::Models::OAuth::Authorization
Returns the authorization code that issued this token to the application for this user.
19 |
# File 'lib/core/models/oauth/access_token.rb', line 19 belongs_to :authorization, class_name: 'Core::Models::OAuth::Authorization', inverse_of: :tokens, optional: true |
#generated ⇒ Core::Models::OAuth::AccessToken
Returns the token that has been generated by the current one.
26 |
# File 'lib/core/models/oauth/access_token.rb', line 26 has_one :generated, class_name: 'Core::Models::OAuth::AccessToken', inverse_of: :generator |
#generator ⇒ Core::Models::Oauth::AccessToken
Returns the token that generated this one.
22 |
# File 'lib/core/models/oauth/access_token.rb', line 22 belongs_to :generator, class_name: 'Core::Models::OAuth::AccessToken', inverse_of: :generated, optional: true |
#value ⇒ String
Returns the value of the token, returned to the application when built.
15 |
# File 'lib/core/models/oauth/access_token.rb', line 15 field :value, type: String, default: ->{ SecureRandom.hex } |
Instance Method Details
#premium ⇒ Object
38 39 40 |
# File 'lib/core/models/oauth/access_token.rb', line 38 def premium .application.premium end |
#scopes ⇒ Array<Core::Models::OAuth::Scope>
Returns the scopes this access token can use to access the application
34 35 36 |
# File 'lib/core/models/oauth/access_token.rb', line 34 def scopes premium ? Core::Models::OAuth::Scope.all.to_a : .scopes end |