Class: StandardId::Api::WellKnown::OpenidConfigurationController

Inherits:
ActionController::API
  • Object
show all
Includes:
ControllerPolicy
Defined in:
app/controllers/standard_id/api/well_known/openid_configuration_controller.rb

Instance Method Summary collapse

Methods included from ControllerPolicy

all_controllers, authenticated_controllers, public_controllers, register, registry_snapshot, reset_registry!

Instance Method Details

#showObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/standard_id/api/well_known/openid_configuration_controller.rb', line 8

def show
  resolved = StandardId::Oauth::DiscoveryResolver.resolve(request: request)

  unless resolved[:issuer].present?
    render json: { error: "Issuer not configured" }, status: :not_found
    return
  end

  response.headers["Cache-Control"] = "public, max-age=3600"
  render json: StandardId::Oauth::DiscoveryDocument.build(
    resolved[:issuer],
    endpoint_base: resolved[:endpoint_base],
    registration_enabled: StandardId.config.oauth.dynamic_registration_enabled,
    introspection_enabled: StandardId.config.oauth.introspection_enabled,
    overrides: resolved[:overrides]
  )
end