Class: JwksController

Inherits:
Doorkeeper::OpenidConnect::DiscoveryController
  • Object
show all
Includes:
Gitlab::EndpointAttributes
Defined in:
app/controllers/jwks_controller.rb

Constant Summary collapse

DYNAMIC_REGISTRATION_PATH =
'/oauth/register'
OAUTH_PATHS =
[
  '/.well-known/oauth-authorization-server',
  '/.well-known/oauth-authorization-server/api/v4/mcp',
  '/.well-known/openid-configuration/api/v4/mcp'
].freeze

Constants included from Gitlab::EndpointAttributes

Gitlab::EndpointAttributes::DEFAULT_URGENCY

Instance Method Summary collapse

Instance Method Details

#keysObject



16
17
18
19
20
# File 'app/controllers/jwks_controller.rb', line 16

def keys
  expires_in 24.hours, public: true, must_revalidate: true, 'no-transform': true

  render json: { keys: payload }
end

#providerObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/jwks_controller.rb', line 22

def provider
  if request.path.in?(OAUTH_PATHS)
    expires_in 24.hours, public: true, must_revalidate: true, 'no-transform': true
    response_hash = provider_response
    response_hash[:registration_endpoint] = Gitlab::Utils.append_path(
      Gitlab.config.gitlab.url, DYNAMIC_REGISTRATION_PATH
    )
    render json: response_hash

    return
  end

  super
end