Class: Doorkeeper::OAuth::Client::Credentials
- Inherits:
-
Struct
- Object
- Struct
- Doorkeeper::OAuth::Client::Credentials
- Defined in:
- lib/doorkeeper/oauth/client/credentials.rb
Instance Attribute Summary collapse
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#uid ⇒ Object
Returns the value of attribute uid.
Class Method Summary collapse
- .from_basic(request) ⇒ Object
- .from_params(request) ⇒ Object
- .from_request(request, *credentials_methods) ⇒ Object
Instance Attribute Details
#secret ⇒ Object
Returns the value of attribute secret
6 7 8 |
# File 'lib/doorkeeper/oauth/client/credentials.rb', line 6 def secret @secret end |
#uid ⇒ Object
Returns the value of attribute uid
6 7 8 |
# File 'lib/doorkeeper/oauth/client/credentials.rb', line 6 def uid @uid end |
Class Method Details
.from_basic(request) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/doorkeeper/oauth/client/credentials.rb', line 20 def from_basic(request) = request. if .present? && =~ /^Basic (.*)/m Base64.decode64(Regexp.last_match(1)).split(/:/, 2) end end |
.from_params(request) ⇒ Object
16 17 18 |
# File 'lib/doorkeeper/oauth/client/credentials.rb', line 16 def from_params(request) request.parameters.values_at(:client_id, :client_secret) end |
.from_request(request, *credentials_methods) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/doorkeeper/oauth/client/credentials.rb', line 8 def from_request(request, *credentials_methods) credentials_methods.inject(nil) do |_, method| method = self.method(method) if method.is_a?(Symbol) credentials = Credentials.new(*method.call(request)) break credentials if credentials.present? end end |