mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-15 21:03:47 +00:00
Merge commit from fork
This commit is contained in:
@@ -1115,25 +1115,20 @@ router.get("/oidc/callback", async (req, res) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (tokenData.id_token) {
|
if (tokenData.id_token) {
|
||||||
try {
|
userInfo = await verifyOIDCToken(
|
||||||
userInfo = await verifyOIDCToken(
|
tokenData.id_token as string,
|
||||||
tokenData.id_token as string,
|
config.issuer_url,
|
||||||
config.issuer_url,
|
config.client_id,
|
||||||
config.client_id,
|
caCert,
|
||||||
caCert,
|
);
|
||||||
);
|
|
||||||
} catch {
|
const expectedNonce = (storedNonce as { value: string }).value;
|
||||||
try {
|
if (userInfo.nonce !== expectedNonce) {
|
||||||
const parts = (tokenData.id_token as string).split(".");
|
authLogger.warn("OIDC ID token nonce mismatch", {
|
||||||
if (parts.length === 3) {
|
operation: "oidc_nonce_mismatch",
|
||||||
const payload = JSON.parse(
|
providerId: callbackProviderId,
|
||||||
Buffer.from(parts[1], "base64").toString(),
|
});
|
||||||
);
|
return res.status(401).json({ error: "Invalid OIDC token nonce" });
|
||||||
userInfo = payload;
|
|
||||||
}
|
|
||||||
} catch (decodeError) {
|
|
||||||
authLogger.error("Failed to decode ID token payload:", decodeError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user