Add additional SAML configuration options

This commit is contained in:
Joel Low
2020-12-29 16:29:04 +08:00
parent 0acf4c9299
commit 79868eb110
4 changed files with 27 additions and 17 deletions
+5
View File
@@ -47,6 +47,11 @@ export interface Config {
saml?: {
entryPoint: string;
issuer: string;
cert?: string;
privateKey?: string;
decryptionPvk?: string;
signatureAlgorithm?: 'sha1' | 'sha256' | 'sha512';
digestAlgorithm?: string;
};
okta?: {
development: { [key: string]: string };
+1 -1
View File
@@ -58,7 +58,7 @@
"passport-oauth2": "^1.5.0",
"passport-okta-oauth": "^0.0.1",
"passport-onelogin-oauth": "^0.0.1",
"passport-saml": "^1.3.3",
"passport-saml": "^1.3.5, <1.4.0",
"uuid": "^8.0.0",
"winston": "^3.2.1",
"yn": "^4.0.0"
@@ -16,6 +16,7 @@
import express from 'express';
import {
SamlConfig,
Strategy as SamlStrategy,
Profile as SamlProfile,
VerifyWithoutRequest,
@@ -112,27 +113,31 @@ export class SamlAuthProvider implements AuthProviderRouteHandlers {
}
}
type SAMLProviderOptions = {
entryPoint: string;
issuer: string;
path: string;
type SAMLProviderOptions = SamlConfig & {
tokenIssuer: TokenIssuer;
appUrl: string;
};
type SignatureAlgorithm = 'sha1' | 'sha256' | 'sha512';
export const createSamlProvider: AuthProviderFactory = ({
providerId,
globalConfig,
config,
tokenIssuer,
}) => {
const url = new URL(globalConfig.baseUrl);
const entryPoint = config.getString('entryPoint');
const issuer = config.getString('issuer');
const opts = {
entryPoint,
issuer,
path: `${url.pathname}/${providerId}/handler/frame`,
callbackUrl: `${globalConfig.baseUrl}/${providerId}/handler/frame`,
entryPoint: config.getString('entryPoint'),
issuer: config.getString('issuer'),
cert: config.getOptionalString('cert'),
privateCert: config.getOptionalString('privateKey'),
decryptionPvk: config.getOptionalString('decryptionPvk'),
signatureAlgorithm: config.getOptionalString('signatureAlgorithm') as
| SignatureAlgorithm
| undefined,
digestAlgorithm: config.getOptionalString('digestAlgorithm'),
tokenIssuer,
appUrl: globalConfig.appUrl,
};
+6 -6
View File
@@ -19055,16 +19055,16 @@ passport-onelogin-oauth@^0.0.1:
pkginfo "0.2.x"
uid2 "0.0.3"
passport-saml@^1.3.3:
version "1.3.3"
resolved "https://registry.npmjs.org/passport-saml/-/passport-saml-1.3.3.tgz#cbea1a2b21ff32b3bc4bfd84dc39c3a370df9935"
integrity sha512-54ecY/A6UEsyCehJws6a+J6THvwtYnGl9cnAUxx5DjsuKgZrDs0tSy58K4hCk1XG/LOcdQSF1TR3xlRXgTULhA==
"passport-saml@^1.3.5, <1.4.0":
version "1.3.5"
resolved "https://registry.npmjs.org/passport-saml/-/passport-saml-1.3.5.tgz#747f2c8bb8b9fed41e8cd14586df5aa83e8a8996"
integrity sha512-HFamiqgGiMRCbUBm3wx02WYWKb6ojke0WJHrg4QXI8tx35HrTmDiY8MksUXhouJtEkfcRwXjBL2cSEpRQ6+PgQ==
dependencies:
debug "^3.1.0"
passport-strategy "*"
q "^1.5.0"
xml-crypto "^1.4.0"
xml-encryption "^1.0.0"
xml-encryption "1.2.1"
xml2js "0.4.x"
xmlbuilder "^11.0.0"
xmldom "0.1.x"
@@ -25236,7 +25236,7 @@ xml-crypto@^1.4.0:
xmldom "0.1.27"
xpath "0.0.27"
xml-encryption@^1.0.0:
xml-encryption@1.2.1:
version "1.2.1"
resolved "https://registry.npmjs.org/xml-encryption/-/xml-encryption-1.2.1.tgz#e6d18817c4309fd07ca7793cca93c3fd06745baa"
integrity sha512-hn5w3l5p2+nGjlmM0CAhMChDzVGhW+M37jH35Z+GJIipXbn9PUlAIRZ6I5Wm7ynlqZjFrMAr83d/CIp9VZJMTA==