Sha256: f20e375a430e84cce3562ffaf58aff24333165fcbfab91aa722a5b4210bb403f

Contents?: true

Size: 887 Bytes

Versions: 3

Compression:

Stored size: 887 Bytes

Contents

module Doorkeeper
  module OAuth
    module Authorization
      class Token
        attr_accessor :pre_auth, :resource_owner, :token

        def initialize(pre_auth, resource_owner)
          @pre_auth       = pre_auth
          @resource_owner = resource_owner
        end

        def issue_token
          @token ||= AccessToken.create!(
            application_id: pre_auth.client.id,
            resource_owner_id: resource_owner.id,
            scopes: pre_auth.scopes.to_s,
            expires_in: configuration.access_token_expires_in,
            use_refresh_token: false
          )
        end

        def native_redirect
          {
            controller: 'doorkeeper/token_info',
            action: :show,
            access_token: token.token
          }
        end

        def configuration
          Doorkeeper.configuration
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-1.4.2 lib/doorkeeper/oauth/authorization/token.rb
doorkeeper-1.4.1 lib/doorkeeper/oauth/authorization/token.rb
doorkeeper-1.4.0 lib/doorkeeper/oauth/authorization/token.rb