Add JumpCloud SAML

This commit is contained in:
Tuan Dang
2023-07-30 14:29:47 +07:00
parent ba6355e4d2
commit 6729caeb75
20 changed files with 106 additions and 17 deletions

View File

@@ -2,7 +2,8 @@ import { Schema, Types, model } from "mongoose";
export enum AuthProvider {
OKTA_SAML = "okta-saml",
AZURE_SAML = "azure-saml"
AZURE_SAML = "azure-saml",
JUMPCLOUD_SAML = "jumpcloud-saml"
}
export interface ISSOConfig {

View File

@@ -3,7 +3,9 @@ import { Document, Schema, Types, model } from "mongoose";
export enum AuthProvider {
EMAIL = "email",
GOOGLE = "google",
OKTA_SAML = "okta-saml"
OKTA_SAML = "okta-saml",
AZURE_SAML = "azure-saml",
JUMPCLOUD_SAML = "jumpcloud-saml",
}
export interface IUser extends Document {

View File

@@ -141,7 +141,17 @@ const initializePassport = async () => {
ssoConfigId: new Types.ObjectId(ssoIdentifier)
});
const samlConfig = ({
interface ISAMLConfig {
path: string;
callbackURL: string;
entryPoint: string;
issuer: string;
cert: string;
audience: string;
wantAuthnResponseSigned?: boolean;
}
const samlConfig: ISAMLConfig = ({
path: `/api/v1/sso/saml2/${ssoIdentifier}`,
callbackURL: `${await getSiteURL()}/api/v1/sso/saml2${ssoIdentifier}`,
entryPoint: ssoConfig.entryPoint,
@@ -150,6 +160,10 @@ const initializePassport = async () => {
audience: await getSiteURL()
});
if (ssoConfig.authProvider === AuthProvider.JUMPCLOUD_SAML) {
samlConfig.wantAuthnResponseSigned = false;
}
req.ssoConfig = ssoConfig;
done(null, samlConfig);