mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-27 04:10:22 +00:00
Merge pull request #30813 from ksamborski/passport-saml/multiSamlStrategy
Type definitions for passport-saml/multiSamlStrategy
This commit is contained in:
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/bergie/passport-saml
|
||||
// Definitions by: Chris Barth <https://github.com/cjbarth>
|
||||
// Damian Assennato <https://github.com/dassennato>
|
||||
// Karol Samborski <https://github.com/ksamborski>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import express = require('express');
|
||||
import { Strategy, SamlConfig, VerifyWithRequest, VerifyWithoutRequest } from './index';
|
||||
|
||||
export interface MultiSamlConfig extends SamlConfig {
|
||||
getSamlOptions(req: express.Request, callback: (err: Error | null, samlOptions: SamlConfig) => void): void;
|
||||
}
|
||||
|
||||
export class MultiSamlStrategy extends Strategy {
|
||||
constructor(config: MultiSamlConfig, verify: VerifyWithRequest | VerifyWithoutRequest);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import express = require('express');
|
||||
import passport = require('passport');
|
||||
import SamlStrategy = require('passport-saml');
|
||||
import MultiSamlStrategy = require('passport-saml/multiSamlStrategy');
|
||||
import fs = require('fs');
|
||||
|
||||
const samlStrategy = new SamlStrategy.Strategy(
|
||||
@@ -33,3 +34,27 @@ passport.use(samlStrategy);
|
||||
passport.authenticate('samlCustomName', {failureRedirect: '/', failureFlash: true});
|
||||
|
||||
const metadata = samlStrategy.generateServiceProviderMetadata("decryptionCert");
|
||||
|
||||
const multiSamlStrategy = new MultiSamlStrategy.MultiSamlStrategy(
|
||||
{
|
||||
name: 'samlCustomName',
|
||||
path: '/login/callback',
|
||||
entryPoint: 'https://openidp.feide.no/simplesaml/saml2/idp/SSOService.php',
|
||||
issuer: 'passport-saml',
|
||||
getSamlOptions(req: express.Request, callback: (err: Error | null, samlOptions: SamlStrategy.SamlConfig) => void) {
|
||||
callback(null, {
|
||||
name: 'samlCustomName',
|
||||
path: '/login/callback2',
|
||||
entryPoint: 'https://openidp.feide.no/simplesaml/saml2/idp/SSOService.php',
|
||||
issuer: 'passport-saml',
|
||||
});
|
||||
}
|
||||
},
|
||||
(profile: {}, done: (err: Error | null, user: {}, info?: {}) => void) => {
|
||||
const user = {};
|
||||
done(null, user);
|
||||
}
|
||||
);
|
||||
|
||||
passport.use(multiSamlStrategy);
|
||||
passport.authenticate('samlCustomName', {failureRedirect: '/', failureFlash: true});
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"multiSamlStrategy.d.ts",
|
||||
"passport-saml-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user