OpenID Connect: ensure consistent issuer URL
root_url does not know the right protocol in all contexts, some clients are strict when validating this.
This commit is contained in:
parent
d27cd175df
commit
0aba20f85c
3 changed files with 3 additions and 3 deletions
|
|
@ -28,7 +28,7 @@ module Api
|
||||||
class DiscoveryController < ApplicationController
|
class DiscoveryController < ApplicationController
|
||||||
def configuration
|
def configuration
|
||||||
render json: OpenIDConnect::Discovery::Provider::Config::Response.new(
|
render json: OpenIDConnect::Discovery::Provider::Config::Response.new(
|
||||||
issuer: root_url,
|
issuer: AppConfig.environment.url,
|
||||||
registration_endpoint: api_openid_connect_clients_url,
|
registration_endpoint: api_openid_connect_clients_url,
|
||||||
authorization_endpoint: new_api_openid_connect_authorization_url,
|
authorization_endpoint: new_api_openid_connect_authorization_url,
|
||||||
token_endpoint: api_openid_connect_access_tokens_url,
|
token_endpoint: api_openid_connect_access_tokens_url,
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ module Api
|
||||||
def claims
|
def claims
|
||||||
sub = build_sub
|
sub = build_sub
|
||||||
@claims ||= {
|
@claims ||= {
|
||||||
iss: Rails.application.routes.url_helpers.root_url,
|
iss: AppConfig.environment.url,
|
||||||
sub: sub,
|
sub: sub,
|
||||||
aud: @authorization.o_auth_application.client_id,
|
aud: @authorization.o_auth_application.client_id,
|
||||||
exp: @expires_at.to_i,
|
exp: @expires_at.to_i,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ describe Api::OpenidConnect::DiscoveryController, type: :controller do
|
||||||
|
|
||||||
it "should have the issuer as the root url" do
|
it "should have the issuer as the root url" do
|
||||||
json_body = JSON.parse(response.body)
|
json_body = JSON.parse(response.body)
|
||||||
expect(json_body["issuer"]).to eq(root_url)
|
expect(json_body["issuer"]).to eq(AppConfig.environment.url)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should have the appropriate user info endpoint" do
|
it "should have the appropriate user info endpoint" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue