class Doorkeeper::Server

Attributes

context[RW]

Public Class Methods

new(context = nil) click to toggle source
# File lib/doorkeeper/server.rb, line 5
def initialize(context = nil)
  @context = context
end

Public Instance Methods

authorization_request(strategy) click to toggle source
# File lib/doorkeeper/server.rb, line 9
def authorization_request(strategy)
  klass = Request.authorization_strategy strategy
  klass.new self
end
client() click to toggle source
# File lib/doorkeeper/server.rb, line 24
def client
  @client ||= OAuth::Client.authenticate(credentials)
end
client_via_uid() click to toggle source
# File lib/doorkeeper/server.rb, line 28
def client_via_uid
  @client_via_uid ||= OAuth::Client.find(parameters[:client_id])
end
credentials() click to toggle source
# File lib/doorkeeper/server.rb, line 49
def credentials
  methods = Doorkeeper.configuration.client_credentials_methods
  @credentials ||= OAuth::Client::Credentials.from_request(context.request, *methods)
end
current_refresh_token() click to toggle source
# File lib/doorkeeper/server.rb, line 36
def current_refresh_token
  AccessToken.by_refresh_token(parameters[:refresh_token])
end
current_resource_owner() click to toggle source
# File lib/doorkeeper/server.rb, line 32
def current_resource_owner
  context.send :current_resource_owner
end
grant() click to toggle source
# File lib/doorkeeper/server.rb, line 40
def grant
  AccessGrant.by_token(parameters[:code])
end
parameters() click to toggle source

TODO: context should be the request

# File lib/doorkeeper/server.rb, line 20
def parameters
  context.request.parameters
end
resource_owner() click to toggle source

TODO: Use configuration and evaluate proper context on block

# File lib/doorkeeper/server.rb, line 45
def resource_owner
  context.send :resource_owner_from_credentials
end
token_request(strategy) click to toggle source
# File lib/doorkeeper/server.rb, line 14
def token_request(strategy)
  klass = Request.token_strategy strategy
  klass.new self
end