fix(sso): saml redirection (#3343)

* saml redirection

* loh

* lint

* dashboard

* lint

* test

* test

* function based mock idp

* redirection and callbacks

* console

---------

Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
This commit is contained in:
KinfeMichael Tariku
2025-07-18 07:58:12 +03:00
committed by GitHub
parent 322906802f
commit d66c6c935d
2 changed files with 70 additions and 71 deletions

View File

@@ -855,7 +855,9 @@ export const sso = (options?: SSOOptions) => {
});
}
return ctx.json({
url: loginRequest.context,
url: `${loginRequest.context}&RelayState=${encodeURIComponent(
body.callbackURL,
)}`,
redirect: true,
});
}
@@ -1353,9 +1355,10 @@ export const sso = (options?: SSOOptions) => {
let session: Session =
await ctx.context.internalAdapter.createSession(user.id, ctx);
await setSessionCookie(ctx, { session, user });
console.log("RelayState: ", RelayState);
throw ctx.redirect(
RelayState || `${parsedSamlConfig.issuer}/dashboard`,
RelayState ||
`${parsedSamlConfig.callbackUrl}` ||
`${parsedSamlConfig.issuer}`,
);
},
),