Class: Rack::OAuth2::Server::Authorize::Response

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

Direct Known Subclasses

Code::Response, Token::Response

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Response

Returns a new instance of Response.



81
82
83
84
# File 'lib/rack/oauth2/server/authorize.rb', line 81

def initialize(request)
  @state = request.state
  super
end

Instance Method Details

#approve!Object



90
91
92
# File 'lib/rack/oauth2/server/authorize.rb', line 90

def approve!
  @approval = true
end

#approved?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/rack/oauth2/server/authorize.rb', line 86

def approved?
  @approval
end

#finishObject



102
103
104
105
106
107
108
# File 'lib/rack/oauth2/server/authorize.rb', line 102

def finish
  if approved?
    attr_missing!
    redirect redirect_uri_with_credentials
  end
  super
end

#protocol_paramsObject



94
95
96
# File 'lib/rack/oauth2/server/authorize.rb', line 94

def protocol_params
  {state: state}
end

#redirect_uri_with_credentialsObject



98
99
100
# File 'lib/rack/oauth2/server/authorize.rb', line 98

def redirect_uri_with_credentials
  Util.redirect_uri(redirect_uri, protocol_params_location, protocol_params)
end