Skip to content

Commit

Permalink
Merge branch 'master' into bug/circular-reference
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbarth committed Mar 26, 2024
2 parents e6b4bad + 430d94e commit 6962c9d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export type VerifyWithoutRequest = (profile: Profile | null, done: VerifiedCallb

export type PassportSamlConfig = SamlConfig & StrategyOptions;

export type StrategyOptionsCallback = (err: Error | null, samlOptions?: PassportSamlConfig) => void;
export type StrategyOptionsCallback = (
err: Error | null,
samlOptions?: Partial<PassportSamlConfig>
) => void;

interface BaseMultiStrategyConfig {
getSamlOptions(req: express.Request, callback: StrategyOptionsCallback): void;
Expand Down
9 changes: 9 additions & 0 deletions test/multiSamlStrategy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ describe("MultiSamlStrategy()", function () {
expect(strategy).to.be.an.instanceOf(Strategy);
});

it("does not require any properties in the SamlOptionsCallback", function () {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const getSamlOptions: StrategyOptionsCallback = (err, samlOptions) => {
// do nothing; the return type is void
};

getSamlOptions(null, {});
});

it("throws if wrong finder is provided", function () {
function createStrategy() {
return new MultiSamlStrategy({} as MultiStrategyConfig, noop, noop);
Expand Down

0 comments on commit 6962c9d

Please sign in to comment.