Sha256: e0b2632cc3f16d592d5bdb18e73f39142569386eab64f57bd008810c5907a35e

Contents?: true

Size: 791 Bytes

Versions: 46

Compression:

Stored size: 791 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!
            if params['client_id'].present? && @client_id != params['client_id']
              invalid_request! 'Multiple client credentials are provided.'
            end
            super
          rescue AttrRequired::AttrMissing => e
            invalid_request! e.message, state: @state, redirect_uri: @redirect_uri
          end
        end
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
rack-oauth2-2.2.1 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-2.2.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-2.1.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-2.0.1 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-2.0.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-2.0.0.rc3 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-2.0.0.rc2 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-2.0.0.rc1 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.21.3 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.21.2 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.21.1 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.21.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.20.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.19.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.18.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.17.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.16.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.15.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.14.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.13.0 lib/rack/oauth2/server/abstract/request.rb