Skip to content

Commit

Permalink
OpenID Connect: ensure consistent issuer URL
Browse files Browse the repository at this point in the history
root_url does not know the right protocol in all contexts,
some clients are strict when validating this.
  • Loading branch information
jhass committed Oct 24, 2020
1 parent d27cd17 commit 0aba20f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/openid_connect/discovery_controller.rb
Expand Up @@ -28,7 +28,7 @@ module OpenidConnect
class DiscoveryController < ApplicationController
def configuration
render json: OpenIDConnect::Discovery::Provider::Config::Response.new(
issuer: root_url,
issuer: AppConfig.environment.url,
registration_endpoint: api_openid_connect_clients_url,
authorization_endpoint: new_api_openid_connect_authorization_url,
token_endpoint: api_openid_connect_access_tokens_url,
Expand Down
2 changes: 1 addition & 1 deletion lib/api/openid_connect/id_token.rb
Expand Up @@ -53,7 +53,7 @@ def to_response_object(options={})
def claims
sub = build_sub
@claims ||= {
iss: Rails.application.routes.url_helpers.root_url,
iss: AppConfig.environment.url,
sub: sub,
aud: @authorization.o_auth_application.client_id,
exp: @expires_at.to_i,
Expand Down
Expand Up @@ -8,7 +8,7 @@

it "should have the issuer as the root url" do
json_body = JSON.parse(response.body)
expect(json_body["issuer"]).to eq(root_url)
expect(json_body["issuer"]).to eq(AppConfig.environment.url)
end

it "should have the appropriate user info endpoint" do
Expand Down

0 comments on commit 0aba20f

Please sign in to comment.