Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const passport = options.passport;
const wsFedIdpUrl = options.wsFedIdpUrl;
const wsFedRealm = options.wsFedRealm;
const wsFedCertificate = options.wsFedCertificate;
const externalUrl = options.externalUrl;
if (!wsFedIdpUrl || !wsFedRealm || !wsFedCertificate) {
// --- we will know we didn't setup vanguard well
throw new Error(
"Vanguard SSO module is missing one of the following parameters: wsFedIdpUrl, wsFedRealm or wsFedCertificate"
);
}
passport.use(
STRATEGY,
new Strategy(
{
identityProviderUrl: wsFedIdpUrl,
realm: wsFedRealm,
protocol: "wsfed",
cert: wsFedCertificate
},
function(profile: any, cb: Function) {
const email =
profile[
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
];
const displayName =
profile[
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"
] || email;
const id =