Add additional SAML configuration options
This commit is contained in:
Vendored
+5
@@ -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 };
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user