samlify 2.9.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +17 -7
- package/build/index.js.map +1 -1
- package/build/src/api.js +3 -4
- package/build/src/api.js.map +1 -1
- package/build/src/binding-post.js +25 -15
- package/build/src/binding-post.js.map +1 -1
- package/build/src/binding-redirect.js +17 -7
- package/build/src/binding-redirect.js.map +1 -1
- package/build/src/binding-simplesign.js +24 -14
- package/build/src/binding-simplesign.js.map +1 -1
- package/build/src/entity-idp.js +4 -4
- package/build/src/entity-idp.js.map +1 -1
- package/build/src/entity-sp.js +2 -2
- package/build/src/entity-sp.js.map +1 -1
- package/build/src/entity.js +17 -7
- package/build/src/entity.js.map +1 -1
- package/build/src/extractor.js +2 -2
- package/build/src/extractor.js.map +1 -1
- package/build/src/flow.js +4 -5
- package/build/src/flow.js.map +1 -1
- package/build/src/libsaml.js +162 -83
- package/build/src/libsaml.js.map +1 -1
- package/build/src/metadata-idp.js +9 -9
- package/build/src/metadata-idp.js.map +1 -1
- package/build/src/metadata-sp.js +9 -9
- package/build/src/metadata-sp.js.map +1 -1
- package/build/src/metadata.js +17 -7
- package/build/src/metadata.js.map +1 -1
- package/build/src/urn.js +4 -4
- package/build/src/urn.js.map +1 -1
- package/build/src/utility.js +12 -13
- package/build/src/utility.js.map +1 -1
- package/build/src/validator.js +1 -2
- package/build/src/validator.js.map +1 -1
- package/package.json +2 -2
- package/src/libsaml.ts +82 -47
- package/types/src/binding-post.d.ts +1 -1
- package/types/src/binding-simplesign.d.ts +1 -1
- package/types/src/entity.d.ts +1 -2
- package/types/src/extractor.d.ts +1 -1
- package/types/src/libsaml.d.ts +15 -11
- package/types/src/metadata.d.ts +0 -1
- package/types/src/types.d.ts +7 -8
- package/types/src/utility.d.ts +1 -2
- package/types/src/validator.d.ts +1 -1
|
@@ -31,7 +31,7 @@ declare function base64LoginRequest(entity: any, customTagReplacement?: (templat
|
|
|
31
31
|
* @param {string} relayState the relay state
|
|
32
32
|
* @param {function} customTagReplacement used when developers have their own login response template
|
|
33
33
|
*/
|
|
34
|
-
declare function base64LoginResponse(requestInfo: any, entity: any, user?: any, relayState?: string, customTagReplacement?: (template: string) => BindingContext): Promise<BindingSimpleSignContext>;
|
|
34
|
+
declare function base64LoginResponse(requestInfo: any | undefined, entity: any, user?: any, relayState?: string, customTagReplacement?: (template: string) => BindingContext): Promise<BindingSimpleSignContext>;
|
|
35
35
|
declare const simpleSignBinding: {
|
|
36
36
|
base64LoginRequest: typeof base64LoginRequest;
|
|
37
37
|
base64LoginResponse: typeof base64LoginResponse;
|
package/types/src/entity.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { IdpMetadata as IdpMetadataConstructor } from './metadata-idp';
|
|
3
2
|
import { SpMetadata as SpMetadataConstructor } from './metadata-sp';
|
|
4
3
|
import { MetadataIdpConstructor, MetadataSpConstructor, EntitySetting } from './types';
|
|
@@ -31,7 +30,7 @@ export interface ParseResult {
|
|
|
31
30
|
extract: any;
|
|
32
31
|
sigAlg: string;
|
|
33
32
|
}
|
|
34
|
-
export
|
|
33
|
+
export type EntityConstructor = (MetadataIdpConstructor | MetadataSpConstructor) & {
|
|
35
34
|
metadata?: string | Buffer;
|
|
36
35
|
};
|
|
37
36
|
export default class Entity {
|
package/types/src/extractor.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ interface ExtractorField {
|
|
|
6
6
|
attributePath?: string[];
|
|
7
7
|
context?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export type ExtractorFields = ExtractorField[];
|
|
10
10
|
export declare const loginRequestFields: ExtractorFields;
|
|
11
11
|
export declare const loginResponseStatusFields: {
|
|
12
12
|
key: string;
|
package/types/src/libsaml.d.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* @author tngan
|
|
4
4
|
* @desc A simple library including some common functions
|
|
5
5
|
*/
|
|
6
|
-
/// <reference types="node" />
|
|
7
6
|
import { MetadataInterface } from './metadata';
|
|
8
7
|
export interface SignatureConstructor {
|
|
9
8
|
rawSamlMessage: string;
|
|
@@ -58,7 +57,7 @@ export interface LogoutRequestTemplate extends BaseSamlTemplate {
|
|
|
58
57
|
}
|
|
59
58
|
export interface LogoutResponseTemplate extends BaseSamlTemplate {
|
|
60
59
|
}
|
|
61
|
-
export
|
|
60
|
+
export type KeyUse = 'signing' | 'encryption';
|
|
62
61
|
export interface KeyComponent {
|
|
63
62
|
[key: string]: any;
|
|
64
63
|
}
|
|
@@ -86,7 +85,7 @@ export interface LibSamlInterface {
|
|
|
86
85
|
defaultLogoutResponseTemplate: LogoutResponseTemplate;
|
|
87
86
|
}
|
|
88
87
|
declare const _default: {
|
|
89
|
-
createXPath: (local: any, isExtractAll?: boolean
|
|
88
|
+
createXPath: (local: any, isExtractAll?: boolean) => string;
|
|
90
89
|
getQueryParamByType: (type: string) => "SAMLRequest" | "SAMLResponse";
|
|
91
90
|
defaultLoginRequestTemplate: {
|
|
92
91
|
context: string;
|
|
@@ -121,7 +120,7 @@ declare const _default: {
|
|
|
121
120
|
* @param {array} tagValues tag values
|
|
122
121
|
* @return {string}
|
|
123
122
|
*/
|
|
124
|
-
replaceTagsByValue(rawXML: string, tagValues:
|
|
123
|
+
replaceTagsByValue(rawXML: string, tagValues: Record<string, unknown>): string;
|
|
125
124
|
/**
|
|
126
125
|
* @desc Helper function to build the AttributeStatement tag
|
|
127
126
|
* @param {LoginResponseAttribute} attributes an array of attribute configuration
|
|
@@ -146,9 +145,11 @@ declare const _default: {
|
|
|
146
145
|
* @desc Verify the XML signature
|
|
147
146
|
* @param {string} xml xml
|
|
148
147
|
* @param {SignatureVerifierOptions} opts cert declares the X509 certificate
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
* @return {[boolean, string | null]} - A tuple where:
|
|
149
|
+
* - The first element is `true` if the signature is valid, `false` otherwise.
|
|
150
|
+
* - The second element is the cryptographically authenticated assertion node as a string, or `null` if not found.
|
|
151
|
+
*/
|
|
152
|
+
verifySignature(xml: string, opts: SignatureVerifierOptions): (string | boolean)[] | (boolean | null)[];
|
|
152
153
|
/**
|
|
153
154
|
* @desc Helper function to create the key section in metadata (abstraction for signing and encrypt use)
|
|
154
155
|
* @param {string} use type of certificate (e.g. signing, encrypt)
|
|
@@ -164,7 +165,7 @@ declare const _default: {
|
|
|
164
165
|
* @param {string} signingAlgorithm signing algorithm
|
|
165
166
|
* @return {string} message signature
|
|
166
167
|
*/
|
|
167
|
-
constructMessageSignature(octetString: string, key: string, passphrase?: string
|
|
168
|
+
constructMessageSignature(octetString: string, key: string, passphrase?: string, isBase64?: boolean, signingAlgorithm?: string): string | Buffer;
|
|
168
169
|
/**
|
|
169
170
|
* @desc Verifies message signature
|
|
170
171
|
* @param {Metadata} metadata metadata object of identity provider or service provider
|
|
@@ -173,13 +174,16 @@ declare const _default: {
|
|
|
173
174
|
* @param {string} verifyAlgorithm algorithm used to verify
|
|
174
175
|
* @return {boolean} verification result
|
|
175
176
|
*/
|
|
176
|
-
verifyMessageSignature(metadata: any, octetString: string, signature: string | Buffer, verifyAlgorithm?: string
|
|
177
|
+
verifyMessageSignature(metadata: any, octetString: string, signature: string | Buffer, verifyAlgorithm?: string): boolean;
|
|
177
178
|
/**
|
|
178
179
|
* @desc Get the public key in string format
|
|
179
180
|
* @param {string} x509Certificate certificate
|
|
180
181
|
* @return {string} public key
|
|
181
182
|
*/
|
|
182
|
-
getKeyInfo(x509Certificate: string, signatureConfig?: any):
|
|
183
|
+
getKeyInfo(x509Certificate: string, signatureConfig?: any): {
|
|
184
|
+
getKeyInfo: () => string;
|
|
185
|
+
getKey: () => string;
|
|
186
|
+
};
|
|
183
187
|
/**
|
|
184
188
|
* @desc Encrypt the assertion section in Response
|
|
185
189
|
* @param {Entity} sourceEntity source entity
|
|
@@ -187,7 +191,7 @@ declare const _default: {
|
|
|
187
191
|
* @param {string} xml response in xml string format
|
|
188
192
|
* @return {Promise} a promise to resolve the finalized xml
|
|
189
193
|
*/
|
|
190
|
-
encryptAssertion(sourceEntity: any, targetEntity: any, xml?: string
|
|
194
|
+
encryptAssertion(sourceEntity: any, targetEntity: any, xml?: string): Promise<string>;
|
|
191
195
|
/**
|
|
192
196
|
* @desc Decrypt the assertion section in Response
|
|
193
197
|
* @param {string} type only accept SAMLResponse to proceed decryption
|
package/types/src/metadata.d.ts
CHANGED
package/types/src/types.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { LoginResponseTemplate } from './libsaml';
|
|
3
2
|
export { IdentityProvider as IdentityProviderConstructor } from './entity-idp';
|
|
4
3
|
export { IdpMetadata as IdentityProviderMetadata } from './metadata-idp';
|
|
5
4
|
export { ServiceProvider as ServiceProviderConstructor } from './entity-sp';
|
|
6
5
|
export { SpMetadata as ServiceProviderMetadata } from './metadata-sp';
|
|
7
|
-
export
|
|
8
|
-
|
|
6
|
+
export type MetadataFile = string | Buffer;
|
|
7
|
+
type SSOService = {
|
|
9
8
|
isDefault?: boolean;
|
|
10
9
|
Binding: string;
|
|
11
10
|
Location: string;
|
|
@@ -20,7 +19,7 @@ export interface MetadataIdpOptions {
|
|
|
20
19
|
singleLogoutService?: SSOService[];
|
|
21
20
|
requestSignatureAlgorithm?: string;
|
|
22
21
|
}
|
|
23
|
-
export
|
|
22
|
+
export type MetadataIdpConstructor = MetadataIdpOptions | MetadataFile;
|
|
24
23
|
export interface MetadataSpOptions {
|
|
25
24
|
entityID?: string;
|
|
26
25
|
signingCert?: string | Buffer | (string | Buffer)[];
|
|
@@ -37,8 +36,8 @@ export interface MetadataSpOptions {
|
|
|
37
36
|
assertionConsumerService?: SSOService[];
|
|
38
37
|
elementsOrder?: string[];
|
|
39
38
|
}
|
|
40
|
-
export
|
|
41
|
-
export
|
|
39
|
+
export type MetadataSpConstructor = MetadataSpOptions | MetadataFile;
|
|
40
|
+
export type EntitySetting = ServiceProviderSettings & IdentityProviderSettings;
|
|
42
41
|
export interface SignatureConfig {
|
|
43
42
|
prefix?: string;
|
|
44
43
|
location?: {
|
|
@@ -49,7 +48,7 @@ export interface SignatureConfig {
|
|
|
49
48
|
export interface SAMLDocumentTemplate {
|
|
50
49
|
context?: string;
|
|
51
50
|
}
|
|
52
|
-
export
|
|
51
|
+
export type ServiceProviderSettings = {
|
|
53
52
|
metadata?: string | Buffer;
|
|
54
53
|
entityID?: string;
|
|
55
54
|
authnRequestsSigned?: boolean;
|
|
@@ -76,7 +75,7 @@ export declare type ServiceProviderSettings = {
|
|
|
76
75
|
relayState?: string;
|
|
77
76
|
clockDrifts?: [number, number];
|
|
78
77
|
};
|
|
79
|
-
export
|
|
78
|
+
export type IdentityProviderSettings = {
|
|
80
79
|
metadata?: string | Buffer;
|
|
81
80
|
/** signature algorithm */
|
|
82
81
|
requestSignatureAlgorithm?: string;
|
package/types/src/utility.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/**
|
|
3
2
|
* @desc Mimic lodash.zipObject
|
|
4
3
|
* @param arr1 {string[]}
|
|
@@ -35,7 +34,7 @@ export declare function get(obj: any, path: any, defaultValue: any): any;
|
|
|
35
34
|
* @desc Check if the input is string
|
|
36
35
|
* @param {any} input
|
|
37
36
|
*/
|
|
38
|
-
export declare function isString(input: any):
|
|
37
|
+
export declare function isString(input: any): input is string;
|
|
39
38
|
/**
|
|
40
39
|
* @desc Encode string with base64 format
|
|
41
40
|
* @param {string} message plain-text message
|
package/types/src/validator.d.ts
CHANGED