Class: StandardId::Provider::ConsentController

Inherits:
ApplicationController show all
Includes:
ActionController::Cookies
Defined in:
app/controllers/standard_id/provider/consent_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/standard_id/provider/consent_controller.rb', line 17

def create
  ConsentGrant.grant!(
    account: ,
    client_application: @client,
    scopes: authorization_params[:scope]
  )

  authorize_url = build_authorize_redirect
  redirect_to authorize_url, allow_other_host: true, status: :found
end

#destroyObject



28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/standard_id/provider/consent_controller.rb', line 28

def destroy
  redirect_uri = authorization_params[:redirect_uri]

  if redirect_uri.present?
    deny_url = build_error_redirect(redirect_uri, "access_denied", "The user denied the consent request")
    redirect_to deny_url, allow_other_host: true, status: :found
  else
    render json: { error: "access_denied", error_description: "The user denied the consent request" }, status: :forbidden
  end
end

#showObject



9
10
11
12
13
14
15
# File 'app/controllers/standard_id/provider/consent_controller.rb', line 9

def show
  render json: {
    client: { name: @client.name, description: @client.description },
    scopes: requested_scopes,
    authorization_params: authorization_params
  }
end