Sha256: 2ee8f5ea614c0b8e0f3c370ae30bf876d7ef9d9bbc7515916d7ecca675715118
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
require 'doorkeeper/oauth/error' require 'doorkeeper/oauth/error_response' require 'doorkeeper/oauth/scopes' require 'doorkeeper/oauth/token_response' require 'doorkeeper/oauth/client_credentials/creator' require 'doorkeeper/oauth/client_credentials/issuer' require 'doorkeeper/oauth/client_credentials/validation' module Doorkeeper module OAuth class ClientCredentialsRequest attr_accessor :issuer, :server, :client, :original_scopes, :scopes attr_reader :response alias :error_response :response delegate :error, :to => :issuer def issuer @issuer ||= Issuer.new(server, Validation.new(server, self)) end def initialize(server, client, parameters = {}) @client, @server = client, server @response = nil @original_scopes = parameters[:scope] end def authorize status = issuer.create(client, scopes) @response = if status TokenResponse.new(issuer.token) else ErrorResponse.from_request(self) end end # TODO: duplicated code in all flows def scopes @scopes ||= if @original_scopes.present? Doorkeeper::OAuth::Scopes.from_string(@original_scopes) else server.default_scopes end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
couchkeeper-0.6.7 | lib/doorkeeper/oauth/client_credentials_request.rb |