diff --git a/app/controllers/api/openid_connect/clients_controller.rb b/app/controllers/api/openid_connect/clients_controller.rb index d122a1692..2ba6efdbe 100644 --- a/app/controllers/api/openid_connect/clients_controller.rb +++ b/app/controllers/api/openid_connect/clients_controller.rb @@ -12,7 +12,7 @@ module Api def create registrar = OpenIDConnect::Client::Registrar.new(request.url, params) client = Api::OpenidConnect::OAuthApplication.register! registrar - render json: client + render json: client.as_json(root: false) end private diff --git a/features/step_definitions/auth_code_steps.rb b/features/step_definitions/auth_code_steps.rb index 92a1c93d8..36ea99ced 100644 --- a/features/step_definitions/auth_code_steps.rb +++ b/features/step_definitions/auth_code_steps.rb @@ -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 client_json = JSON.parse(last_response.body) - @client_id = client_json['o_auth_application']['client_id'] - @client_secret = client_json['o_auth_application']['client_secret'] + @client_id = client_json["client_id"] + @client_secret = client_json["client_secret"] visit new_api_openid_connect_authorization_path + "?client_id=#{@client_id}&#{o_auth_query_params}" end diff --git a/features/step_definitions/implicit_flow_steps.rb b/features/step_definitions/implicit_flow_steps.rb index cb7394da1..cfeb61009 100644 --- a/features/step_definitions/implicit_flow_steps.rb +++ b/features/step_definitions/implicit_flow_steps.rb @@ -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 client_json = JSON.parse(last_response.body) 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 Given /^I send a post request from that client to the implicit flow authorization endpoint using a invalid client id/ do diff --git a/spec/controllers/api/openid_connect/clients_controller_spec.rb b/spec/controllers/api/openid_connect/clients_controller_spec.rb index e685aeb47..48204c86b 100644 --- a/spec/controllers/api/openid_connect/clients_controller_spec.rb +++ b/spec/controllers/api/openid_connect/clients_controller_spec.rb @@ -10,8 +10,8 @@ describe Api::OpenidConnect::ClientsController, type: :controller do policy_uri: "http://example.com/policy", tos_uri: "http://example.com/tos", sector_identifier_uri: "http://example.com/uris", subject_type: "pairwise" client_json = JSON.parse(response.body) - expect(client_json["o_auth_application"]["client_id"].length).to eq(32) - expect(client_json["o_auth_application"]["ppid"]).to eq(true) + expect(client_json["client_id"].length).to eq(32) + expect(client_json["ppid"]).to eq(true) end end context "when redirect uri is missing" do