Sha256: f6bf12ad05d3e5afb6012968148485fc753042d909871366884cbec1c884cc64

Contents?: true

Size: 908 Bytes

Versions: 72

Compression:

Stored size: 908 Bytes

Contents

module Rack
  module OAuth2
    module Server
      module Abstract
        class Request < Rack::Request
          include AttrRequired, AttrOptional
          attr_required :client_id
          attr_optional :scope

          def initialize(env)
            super
            @client_id ||= params['client_id']
            @scope = Array(params['scope'].to_s.split(' '))
          end

          def attr_missing_with_error_handling!
            if params['client_id'].present? && @client_id != params['client_id']
              invalid_request! 'Multiple client credentials are provided.'
            end
            attr_missing_without_error_handling!
          rescue AttrRequired::AttrMissing => e
            invalid_request! e.message, :state => @state, :redirect_uri => @redirect_uri
          end
          alias_method_chain :attr_missing!, :error_handling
        end
      end
    end
  end
end

Version data entries

72 entries across 72 versions & 2 rubygems

Version Path
rack-oauth2-0.5.1 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.5.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.4.6 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.4.5 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.4.4 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.4.3 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.4.2 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.4.1 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.4.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.3.1 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.3.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.3.0.alpha lib/rack/oauth2/server/abstract/request.rb