class Doorkeeper::OAuth::Authorization::Token
Attributes
pre_auth[RW]
resource_owner[RW]
token[RW]
Public Class Methods
access_token_expires_in(server, pre_auth_or_oauth_client)
click to toggle source
# File lib/doorkeeper/oauth/authorization/token.rb, line 12 def self.access_token_expires_in(server, pre_auth_or_oauth_client) if expiration = custom_expiration(server, pre_auth_or_oauth_client) expiration else server.access_token_expires_in end end
new(pre_auth, resource_owner)
click to toggle source
# File lib/doorkeeper/oauth/authorization/token.rb, line 7 def initialize(pre_auth, resource_owner) @pre_auth = pre_auth @resource_owner = resource_owner end
Private Class Methods
custom_expiration(server, pre_auth_or_oauth_client)
click to toggle source
# File lib/doorkeeper/oauth/authorization/token.rb, line 40 def self.custom_expiration(server, pre_auth_or_oauth_client) oauth_client = if pre_auth_or_oauth_client.respond_to?(:client) pre_auth_or_oauth_client.client else pre_auth_or_oauth_client end server.custom_access_token_expires_in.call(oauth_client) end
Public Instance Methods
issue_token()
click to toggle source
# File lib/doorkeeper/oauth/authorization/token.rb, line 20 def issue_token @token ||= AccessToken.find_or_create_for( pre_auth.client, resource_owner.id, pre_auth.scopes, self.class.access_token_expires_in(configuration, pre_auth), false ) end
native_redirect()
click to toggle source
# File lib/doorkeeper/oauth/authorization/token.rb, line 30 def native_redirect { controller: 'doorkeeper/token_info', action: :show, access_token: token.token } end
Private Instance Methods
configuration()
click to toggle source
# File lib/doorkeeper/oauth/authorization/token.rb, line 50 def configuration Doorkeeper.configuration end