Sha256: 40ff5c2a72f96308b9342eb0bbd86d75656619d9b39937b659af01387bf30367
Contents?: true
Size: 953 Bytes
Versions: 3
Compression:
Stored size: 953 Bytes
Contents
module Doorkeeper module OAuth class Client Credentials = Struct.new(:uid, :secret) do class << self def from_request(request, *credentials_methods) credentials_methods.inject(nil) do |credentials, method| method = self.method(method) if method.is_a?(Symbol) credentials = Credentials.new(*method.call(request)) break credentials unless credentials.blank? end end def from_params(request) request.parameters.values_at(:client_id, :client_secret) end def from_basic(request) authorization = request.authorization if authorization.present? && authorization =~ /^Basic (.*)/m Base64.decode64(Regexp.last_match(1)).split(/:/, 2) end end end def blank? uid.blank? || secret.blank? end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
doorkeeper-4.3.2 | lib/doorkeeper/oauth/client/credentials.rb |
doorkeeper-4.3.1 | lib/doorkeeper/oauth/client/credentials.rb |
doorkeeper-4.3.0 | lib/doorkeeper/oauth/client/credentials.rb |