mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 04:26:11 +00:00
feat: improved saml error messages
This commit is contained in:
Vendored
+1
-1
@@ -136,7 +136,7 @@ declare module "fastify" {
|
|||||||
rateLimits: RateLimitConfiguration;
|
rateLimits: RateLimitConfiguration;
|
||||||
// passport data
|
// passport data
|
||||||
passportUser: {
|
passportUser: {
|
||||||
isUserCompleted: string;
|
isUserCompleted: boolean;
|
||||||
providerAuthToken: string;
|
providerAuthToken: string;
|
||||||
};
|
};
|
||||||
kmipUser: {
|
kmipUser: {
|
||||||
|
|||||||
@@ -223,12 +223,18 @@ export const registerSamlRouter = async (server: FastifyZodProvider) => {
|
|||||||
samlConfigId: z.string().trim()
|
samlConfigId: z.string().trim()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
preValidation: passport.authenticate("saml", {
|
preValidation: passport.authenticate(
|
||||||
session: false,
|
"saml",
|
||||||
failureFlash: true,
|
{
|
||||||
failureRedirect: "/login/provider/error"
|
session: false
|
||||||
// this is due to zod type difference
|
},
|
||||||
}) as any,
|
async (req, res, err, user) => {
|
||||||
|
if (err) {
|
||||||
|
throw new BadRequestError({ message: `Saml authentication failed. ${err?.message}`, error: err });
|
||||||
|
}
|
||||||
|
req.passportUser = user as { isUserCompleted: boolean; providerAuthToken: string };
|
||||||
|
}
|
||||||
|
) as any, // this is due to zod type difference
|
||||||
handler: (req, res) => {
|
handler: (req, res) => {
|
||||||
if (req.passportUser.isUserCompleted) {
|
if (req.passportUser.isUserCompleted) {
|
||||||
return res.redirect(
|
return res.redirect(
|
||||||
|
|||||||
Reference in New Issue
Block a user