Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
johangirod committed Sep 12, 2024
1 parent 51d05cb commit 479e728
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clients/authentication/agent-connect/strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ export const agentConnectAuthenticate = async (req: IReqWithSession) => {
}

const userInfo = (await client.userinfo(tokenSet)) as IAgentConnectUserInfo;
console.log('login:userInfo', userInfo);
req.session.idToken = tokenSet.id_token;
await req.session.save();
console.log('login:session', req.session);

return userInfo;
};
Expand Down
6 changes: 6 additions & 0 deletions cypress/e2e/espace-agent.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ describe(
});

it('Connexion', () => {
cy.clearCookies({
domain: 'fca.integ01.dev-agentconnect.fr',
});
cy.clearCookies({
domain: 'app-sandbox.moncomptepro.beta.gouv.fr',
});
cy.clearCookies();
cy.visit(`/lp/agent-public`);
cy.contains('button', 'AgentConnect').click();
Expand Down
1 change: 1 addition & 0 deletions middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export async function middleware(request: NextRequest) {
response,
sessionOptions
);
console.log('middleware.ts: session', session);
await setVisitTimestamp(session);

return response;
Expand Down
5 changes: 5 additions & 0 deletions pages/api/auth/agent-connect/callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ const logConnexion = (agent: IAgentInfo) => {
export default withSession(async function callbackRoute(req, res) {
try {
const userInfo = await agentConnectAuthenticate(req);
console.log('login:userInfo:2', req.session);
const agent = await getAgent(userInfo);
console.log('login:agent', req.session);

const session = req.session;
console.log('login:2:session', req.session);
await setAgentSession(agent, session);
console.log('login:3:session', req.session);

const pathFrom = decodeURIComponent(getPathFrom(session) || '');

Expand Down

0 comments on commit 479e728

Please sign in to comment.