add feature flipping, just in case

This commit is contained in:
simon lehericey 2024-09-16 13:38:09 +02:00
parent cd2d772cd0
commit 363f70a3fc
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
3 changed files with 5 additions and 1 deletions

View file

@ -29,7 +29,9 @@ class AgentConnect::AgentController < ApplicationController
user_info, id_token, amr = AgentConnectService.user_info(params[:code], cookies.encrypted[NONCE_COOKIE_NAME]) user_info, id_token, amr = AgentConnectService.user_info(params[:code], cookies.encrypted[NONCE_COOKIE_NAME])
cookies.delete NONCE_COOKIE_NAME cookies.delete NONCE_COOKIE_NAME
if user_info['idp_id'] == MON_COMPTE_PRO_IDP_ID && !amr.include?('mfa') if user_info['idp_id'] == MON_COMPTE_PRO_IDP_ID &&
!amr.include?('mfa') &&
Flipper.enabled?(:agent_connect_2fa, Struct.new(:flipper_id).new(flipper_id: user_info['email']))
# we need the id_token to disconnect the agent connect session later. # we need the id_token to disconnect the agent connect session later.
# we cannot store it in the instructeur model because the user is not yet created # we cannot store it in the instructeur model because the user is not yet created
# so we store it in a encrypted cookie # so we store it in a encrypted cookie

View file

@ -20,6 +20,7 @@ end
# A list of features to be deployed on first push # A list of features to be deployed on first push
features = [ features = [
:administrateur_web_hook, :administrateur_web_hook,
:agent_connect_2fa,
:api_particulier, :api_particulier,
:attestation_v2, :attestation_v2,
:blocking_pending_correction, :blocking_pending_correction,

View file

@ -39,6 +39,7 @@ describe AgentConnect::AgentController, type: :controller do
context 'and user_info returns some info' do context 'and user_info returns some info' do
before do before do
expect(AgentConnectService).to receive(:user_info).with(code, nonce).and_return([user_info, id_token, amr]) expect(AgentConnectService).to receive(:user_info).with(code, nonce).and_return([user_info, id_token, amr])
Flipper.enable(:agent_connect_2fa)
end end
context 'and the instructeur use mon_compte_pro' do context 'and the instructeur use mon_compte_pro' do