Skip to content

Commit 3f6de05

Browse files
authored
🤖 Merge PR DefinitelyTyped#74826 [saml] Update types for v4.0.0 by @esetnik
1 parent 300cb7f commit 3f6de05

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

types/saml/index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface SamlSignedOpts {
1414
audiences?: string | string[] | undefined;
1515
cert: Buffer;
1616
digestAlgorithm?: string | undefined;
17+
disallowEncryptionWithInsecureAlgorithm?: boolean | undefined;
1718
encryptionAlgorithm?: string | undefined;
1819
encryptionCert?: Buffer | undefined;
1920
encryptionPublicKey?: Buffer | undefined;
@@ -31,10 +32,12 @@ export interface SamlSignedOpts {
3132
recipient?: string | undefined;
3233
sessionIndex?: string | undefined;
3334
signatureAlgorithm?: string | undefined;
35+
signatureIdAttribute?: string | undefined;
3436
signatureNamespacePrefix?: string | undefined;
3537
subjectConfirmationMethod?: string | undefined;
3638
typedAttributes?: boolean | undefined;
3739
uid?: string | undefined;
40+
warnOnInsecureEncryptionAlgorithm?: boolean | undefined;
3841
xpathToNodeBeforeSignature?: string | undefined;
3942
}
4043

@@ -44,6 +47,7 @@ export interface SamlUnassignedOpts {
4447
audiences?: string | string[] | undefined;
4548
cert?: Buffer | undefined;
4649
digestAlgorithm?: string | undefined;
50+
disallowEncryptionWithInsecureAlgorithm?: boolean | undefined;
4751
encryptionAlgorithm?: string | undefined;
4852
encryptionCert?: Buffer | undefined;
4953
encryptionPublicKey?: Buffer | undefined;
@@ -65,6 +69,7 @@ export interface SamlUnassignedOpts {
6569
subjectConfirmationMethod?: string | undefined;
6670
typedAttributes?: boolean | undefined;
6771
uid?: string | undefined;
72+
warnOnInsecureEncryptionAlgorithm?: boolean | undefined;
6873
xpathToNodeBeforeSignature?: string | undefined;
6974
}
7075
export namespace Saml11 {

types/saml/saml-tests.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,30 @@ Saml20.createUnsignedAssertion(
8585
},
8686
() => {},
8787
);
88+
89+
// v4.0 encryption options
90+
Saml20.create(
91+
{
92+
cert: Buffer.from("certificate"),
93+
key: Buffer.from("key"),
94+
encryptionCert: Buffer.from("encryption-cert"),
95+
encryptionAlgorithm: "http://www.w3.org/2009/xmlenc11#aes256-gcm",
96+
keyEncryptionAlgorithm: "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p",
97+
disallowEncryptionWithInsecureAlgorithm: true,
98+
warnOnInsecureEncryptionAlgorithm: false,
99+
},
100+
() => {},
101+
);
102+
103+
// v4.0 signatureIdAttribute option
104+
Saml11.create({
105+
cert: Buffer.from("certificate"),
106+
key: Buffer.from("key"),
107+
signatureIdAttribute: "ID",
108+
});
109+
110+
// ReadonlyArray attribute values
111+
const attrs: SamlAttributes = {
112+
email: "foo@bar.com",
113+
groups: ["Group1", "Group2"] as ReadonlyArray<string>,
114+
};

0 commit comments

Comments
 (0)