8
8
isWithinTwoFactorAuthenticatedSession ,
9
9
} from "../managers/session/authenticated" ;
10
10
import { setLoginHintInUnauthenticatedSession } from "../managers/session/unauthenticated" ;
11
+ import { findByClientId } from "../repositories/oidc-client" ;
11
12
import epochTime from "../services/epoch-time" ;
12
13
import { mustReturnOneOrganizationInPayload } from "../services/must-return-one-organization-in-payload" ;
13
14
import { shouldTrigger2fa } from "../services/should-trigger-2fa" ;
@@ -18,7 +19,7 @@ export const interactionStartControllerFactory =
18
19
try {
19
20
const {
20
21
uid : interactionId ,
21
- params : { login_hint, scope } ,
22
+ params : { client_id , login_hint, scope } ,
22
23
prompt,
23
24
} = await oidcProvider . interactionDetails ( req , res ) ;
24
25
@@ -29,6 +30,10 @@ export const interactionStartControllerFactory =
29
30
req . session . mustUse2FA = true ;
30
31
}
31
32
33
+ const oidcClient = await findByClientId ( client_id ) ;
34
+ req . session . authForProconnectFederation =
35
+ oidcClient ?. is_proconnect_federation ;
36
+
32
37
if ( login_hint ) {
33
38
setLoginHintInUnauthenticatedSession ( req , login_hint ) ;
34
39
}
@@ -102,6 +107,7 @@ export const interactionEndControllerFactory =
102
107
req . session . interactionId = undefined ;
103
108
req . session . mustReturnOneOrganizationInPayload = undefined ;
104
109
req . session . mustUse2FA = undefined ;
110
+ req . session . authForProconnectFederation = undefined ;
105
111
106
112
await oidcProvider . interactionFinished ( req , res , result ) ;
107
113
} catch ( error ) {
0 commit comments