Class: Rack::OAuth2::Server::Authorize::Request

Inherits:
Rack::OAuth2::Server::Abstract::Request show all
Defined in:
lib/rack/oauth2/server/authorize.rb

Direct Known Subclasses

Code::Request, Token::Request

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Rack::OAuth2::Server::Abstract::Request

#attr_missing!

Constructor Details

#initialize(env) ⇒ Request

Returns a new instance of Request.



41
42
43
44
45
46
47
# File 'lib/rack/oauth2/server/authorize.rb', line 41

def initialize(env)
  super
  # NOTE: Raise before redirect_uri is saved not to redirect back to unverified redirect_uri.
  bad_request! if client_id.blank?
  @redirect_uri = Util.parse_uri(params['redirect_uri']) if params['redirect_uri']
  @state = params['state']
end

Instance Attribute Details

#verified_redirect_uriObject

Returns the value of attribute verified_redirect_uri.



39
40
41
# File 'lib/rack/oauth2/server/authorize.rb', line 39

def verified_redirect_uri
  @verified_redirect_uri
end

Instance Method Details

#error_params_locationObject



71
72
73
# File 'lib/rack/oauth2/server/authorize.rb', line 71

def error_params_location
  nil # => All errors are raised immediately and no error response are returned to client.
end

#verify_redirect_uri!(pre_registered, allow_partial_match = false) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/rack/oauth2/server/authorize.rb', line 49

def verify_redirect_uri!(pre_registered, allow_partial_match = false)
  @verified_redirect_uri = if redirect_uri.present?
    verified = Array(pre_registered).any? do |_pre_registered_|
      if allow_partial_match
        Util.uri_match?(_pre_registered_, redirect_uri)
      else
        _pre_registered_.to_s == redirect_uri.to_s
      end
    end
    if verified
      redirect_uri
    else
      bad_request!
    end
  elsif pre_registered.present? && Array(pre_registered).size == 1 && !allow_partial_match
    Array(pre_registered).first
  else
    bad_request!
  end
  self.verified_redirect_uri.to_s
end