Sha256: 2d929f5bf2a62fffda532100c300fcb7d00eb2148d0c92cc6e30004747a4e38c

Contents?: true

Size: 893 Bytes

Versions: 23

Compression:

Stored size: 893 Bytes

Contents

require 'doorkeeper/oauth/client_credentials/validation'

module Doorkeeper
  module OAuth
    class ClientCredentialsRequest
      class Issuer
        attr_accessor :token, :validation, :error

        def initialize(server, validation)
          @server, @validation = server, validation
        end

        def create(client, scopes, creator = Creator.new)
          if validation.valid?
            @token = create_token(client, scopes, creator)
            @error = :server_error unless @token
          else
            @token = false
            @error = validation.error
          end
          @token
        end

        private

        def create_token(client, scopes, creator)
          creator.call(client, scopes, {
            :use_refresh_token => false,
            :expires_in        => @server.access_token_expires_in
          })
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
doorkeeper-1.1.0 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-1.0.0 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-1.0.0.rc2 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-1.0.0.rc1 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.7.4 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.7.3 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.7.2 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.7.1 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.7.0 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.6.7 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.6.6 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.6.5 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.6.4 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.6.3 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.6.2 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.6.1 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.6.0 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.6.0.rc1 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.5.0 lib/doorkeeper/oauth/client_credentials/issuer.rb
doorkeeper-0.5.0.rc1 lib/doorkeeper/oauth/client_credentials/issuer.rb