From c1199af83dc0ffd97181bfcf6f9c0fab31c168a7 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Tue, 12 Dec 2023 15:02:22 +0100 Subject: [PATCH] feat(file retrieval): attach agent_connect_information to instructeur --- app/controllers/agent_connect/agent_controller.rb | 3 +++ app/services/agent_connect_service.rb | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/agent_connect/agent_controller.rb b/app/controllers/agent_connect/agent_controller.rb index 15d9f16d1..1eb045382 100644 --- a/app/controllers/agent_connect/agent_controller.rb +++ b/app/controllers/agent_connect/agent_controller.rb @@ -35,6 +35,9 @@ class AgentConnect::AgentController < ApplicationController instructeur.update(agent_connect_id: user_info['sub']) end + aci = AgentConnectInformation.find_or_initialize_by(instructeur:) + aci.update(user_info.slice('given_name', 'usual_name', 'email', 'sub', 'siret', 'organizational_unit', 'belonging_population', 'phone')) + sign_in(:user, instructeur.user) redirect_to instructeur_procedures_path diff --git a/app/services/agent_connect_service.rb b/app/services/agent_connect_service.rb index bb41170d0..949c32729 100644 --- a/app/services/agent_connect_service.rb +++ b/app/services/agent_connect_service.rb @@ -12,9 +12,9 @@ class AgentConnectService nonce = SecureRandom.hex(16) uri = client.authorization_uri( - scope: [:openid, :email], - state: state, - nonce: nonce, + scope: [:openid, :email, :given_name, :usual_name, :organizational_unit, :belonging_population, :siret], + state:, + nonce:, acr_values: 'eidas1' )