Class: Doorkeeper::Server
- Inherits:
-
Object
- Object
- Doorkeeper::Server
- Defined in:
- lib/doorkeeper/server.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
- #authorization_request(strategy) ⇒ Object
- #client ⇒ Object
- #credentials ⇒ Object
- #current_resource_owner ⇒ Object
-
#initialize(context) ⇒ Server
constructor
A new instance of Server.
-
#parameters ⇒ Object
TODO: context should be the request.
-
#resource_owner ⇒ Object
TODO: Use configuration and evaluate proper context on block.
- #token_request(strategy) ⇒ Object
Constructor Details
#initialize(context) ⇒ Server
Returns a new instance of Server.
7 8 9 |
# File 'lib/doorkeeper/server.rb', line 7 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/doorkeeper/server.rb', line 5 def context @context end |
Instance Method Details
#authorization_request(strategy) ⇒ Object
11 12 13 14 |
# File 'lib/doorkeeper/server.rb', line 11 def (strategy) klass = Request.(strategy) klass.new(self) end |
#client ⇒ Object
26 27 28 |
# File 'lib/doorkeeper/server.rb', line 26 def client @client ||= OAuth::Client.authenticate(credentials) end |
#credentials ⇒ Object
39 40 41 42 |
# File 'lib/doorkeeper/server.rb', line 39 def credentials methods = Doorkeeper.config.client_credentials_methods @credentials ||= OAuth::Client::Credentials.from_request(context.request, *methods) end |
#current_resource_owner ⇒ Object
30 31 32 |
# File 'lib/doorkeeper/server.rb', line 30 def current_resource_owner context.send :current_resource_owner end |
#parameters ⇒ Object
TODO: context should be the request
22 23 24 |
# File 'lib/doorkeeper/server.rb', line 22 def parameters context.request.parameters end |
#resource_owner ⇒ Object
TODO: Use configuration and evaluate proper context on block
35 36 37 |
# File 'lib/doorkeeper/server.rb', line 35 def resource_owner context.send :resource_owner_from_credentials end |
#token_request(strategy) ⇒ Object
16 17 18 19 |
# File 'lib/doorkeeper/server.rb', line 16 def token_request(strategy) klass = Request.token_strategy(strategy) klass.new(self) end |