Skip to content
Extraits de code Groupes Projets
Valider dd337d41 rédigé par theworldbright's avatar theworldbright
Parcourir les fichiers

Remove JSON root from client controller

parent 308170f6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -12,7 +12,7 @@ module Api ...@@ -12,7 +12,7 @@ module Api
def create def create
registrar = OpenIDConnect::Client::Registrar.new(request.url, params) registrar = OpenIDConnect::Client::Registrar.new(request.url, params)
client = Api::OpenidConnect::OAuthApplication.register! registrar client = Api::OpenidConnect::OAuthApplication.register! registrar
render json: client render json: client.as_json(root: false)
end end
private private
......
...@@ -8,8 +8,8 @@ o_auth_query_params = %i( ...@@ -8,8 +8,8 @@ o_auth_query_params = %i(
Given /^I send a post request from that client to the code flow authorization endpoint$/ do Given /^I send a post request from that client to the code flow authorization endpoint$/ do
client_json = JSON.parse(last_response.body) client_json = JSON.parse(last_response.body)
@client_id = client_json['o_auth_application']['client_id'] @client_id = client_json["client_id"]
@client_secret = client_json['o_auth_application']['client_secret'] @client_secret = client_json["client_secret"]
visit new_api_openid_connect_authorization_path + visit new_api_openid_connect_authorization_path +
"?client_id=#{@client_id}&#{o_auth_query_params}" "?client_id=#{@client_id}&#{o_auth_query_params}"
end end
......
...@@ -9,7 +9,7 @@ o_auth_query_params = %i( ...@@ -9,7 +9,7 @@ o_auth_query_params = %i(
Given /^I send a post request from that client to the implicit flow authorization endpoint$/ do Given /^I send a post request from that client to the implicit flow authorization endpoint$/ do
client_json = JSON.parse(last_response.body) client_json = JSON.parse(last_response.body)
visit new_api_openid_connect_authorization_path + visit new_api_openid_connect_authorization_path +
"?client_id=#{client_json['o_auth_application']['client_id']}&#{o_auth_query_params}" "?client_id=#{client_json["client_id"]}&#{o_auth_query_params}"
end end
Given /^I send a post request from that client to the implicit flow authorization endpoint using a invalid client id/ do Given /^I send a post request from that client to the implicit flow authorization endpoint using a invalid client id/ do
......
...@@ -10,8 +10,8 @@ describe Api::OpenidConnect::ClientsController, type: :controller do ...@@ -10,8 +10,8 @@ describe Api::OpenidConnect::ClientsController, type: :controller do
policy_uri: "http://example.com/policy", tos_uri: "http://example.com/tos", policy_uri: "http://example.com/policy", tos_uri: "http://example.com/tos",
sector_identifier_uri: "http://example.com/uris", subject_type: "pairwise" sector_identifier_uri: "http://example.com/uris", subject_type: "pairwise"
client_json = JSON.parse(response.body) client_json = JSON.parse(response.body)
expect(client_json["o_auth_application"]["client_id"].length).to eq(32) expect(client_json["client_id"].length).to eq(32)
expect(client_json["o_auth_application"]["ppid"]).to eq(true) expect(client_json["ppid"]).to eq(true)
end end
end end
context "when redirect uri is missing" do context "when redirect uri is missing" do
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter