Sha256: 59ee269a0e90f94b785860f6b728aa9a50b63af0860c06a6d21fae28020b691b

Contents?: true

Size: 1.45 KB

Versions: 6

Compression:

Stored size: 1.45 KB

Contents

module Rack
  module OAuth2
    module Server
      class Authorize
        module ErrorWithConnectExt
          DEFAULT_DESCRIPTION = {
            :invalid_redirect_uri => 'The redirect_uri in the request does not match any of pre-registered redirect_uris.',
            :interaction_required => 'End-User interaction required.',
            :login_required => 'End-User authentication required.',
            :session_selection_required => 'The End-User is required to select a session at the Authorization Server.',
            :consent_required => 'End-User consent required.',
            :invalid_request_uri => 'The request_uri in the request returns an error or invalid data.',
            :invalid_openid_request_object => 'The request parameter contains an invalid OpenID Request Object.'
          }

          def self.included(klass)
            DEFAULT_DESCRIPTION.each do |error, default_description|
              # NOTE:
              #  Connect Message spec doesn't say anything about HTTP status code for each error code.
              #  It probably means "use 400".
              error_method = :bad_request!
              klass.class_eval <<-ERROR
                def #{error}!(description = "#{default_description}", options = {})
                  #{error_method} :#{error}, description, options
                end
              ERROR
            end
          end
        end
        Request.send :include, ErrorWithConnectExt
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
openid_connect-0.3.3 lib/rack/oauth2/server/authorize/error_with_connect_ext.rb
openid_connect-0.3.2 lib/rack/oauth2/server/authorize/error_with_connect_ext.rb
openid_connect-0.3.1 lib/rack/oauth2/server/authorize/error_with_connect_ext.rb
openid_connect-0.3.0 lib/rack/oauth2/server/authorize/error_with_connect_ext.rb
openid_connect-0.2.4 lib/rack/oauth2/server/authorize/error_with_connect_ext.rb
openid_connect-0.2.3 lib/rack/oauth2/server/authorize/error_with_connect_ext.rb