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-1.1.1 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.1.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.0.10 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.0.9 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.0.8 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-revibe-1.0.7 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.0.7 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.0.6 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.0.5 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.0.4 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.0.3 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.0.2 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.0.1 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-1.0.0 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.14.9 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.14.8 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.14.7 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.14.6 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.14.5 lib/rack/oauth2/server/abstract/request.rb
rack-oauth2-0.14.4 lib/rack/oauth2/server/abstract/request.rb