Fix webfinger discovery route

This commit is contained in:
theworldbright 2015-08-07 15:46:32 +09:00
parent ab65617958
commit 24fd70676c
3 changed files with 4 additions and 4 deletions

View file

@ -5,7 +5,7 @@ module Api
jrd = { jrd = {
links: [{ links: [{
rel: OpenIDConnect::Discovery::Provider::Issuer::REL_VALUE, rel: OpenIDConnect::Discovery::Provider::Issuer::REL_VALUE,
href: File.join(root_url, "api", "openid_connect") href: root_url
}] }]
} }
jrd[:subject] = params[:resource] if params[:resource].present? jrd[:subject] = params[:resource] if params[:resource].present?

View file

@ -247,13 +247,13 @@ Diaspora::Application.routes.draw do
resources :authorizations, only: %i(new create destroy) resources :authorizations, only: %i(new create destroy)
post "authorizations/new", to: "authorizations#new" post "authorizations/new", to: "authorizations#new"
get ".well-known/webfinger", to: "discovery#webfinger"
get ".well-known/openid-configuration", to: "discovery#configuration"
get "jwks.json", to: "id_tokens#jwks" get "jwks.json", to: "id_tokens#jwks"
get "user_info", to: "user_info#show" get "user_info", to: "user_info#show"
end end
end end
get ".well-known/webfinger", to: "api/openid_connect/discovery#webfinger"
get ".well-known/openid-configuration", to: "api/openid_connect/discovery#configuration"
get "user_applications", to: "user_applications#index" get "user_applications", to: "user_applications#index"
end end

View file

@ -8,7 +8,7 @@ describe Api::OpenidConnect::DiscoveryController, type: :controller do
it "should return a url to the openid-configuration" do it "should return a url to the openid-configuration" do
json_body = JSON.parse(response.body) json_body = JSON.parse(response.body)
expect(json_body["links"].first["href"]).to eq("http://test.host/api/openid_connect") expect(json_body["links"].first["href"]).to eq("http://test.host/")
end end
it "should return the resource in the subject" do it "should return the resource in the subject" do