samlify 2.11.0 → 2.13.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/README.md +1 -1
- package/build/src/api.js +52 -3
- package/build/src/api.js.map +1 -1
- package/build/src/binding-post.js +236 -182
- package/build/src/binding-post.js.map +1 -1
- package/build/src/binding-redirect.js +303 -215
- package/build/src/binding-redirect.js.map +1 -1
- package/build/src/binding-simplesign.js +285 -137
- package/build/src/binding-simplesign.js.map +1 -1
- package/build/src/entity-idp.js +130 -47
- package/build/src/entity-idp.js.map +1 -1
- package/build/src/entity-sp.js +81 -39
- package/build/src/entity-sp.js.map +1 -1
- package/build/src/entity.js +100 -62
- package/build/src/entity.js.map +1 -1
- package/build/src/extractor.js +119 -155
- package/build/src/extractor.js.map +1 -1
- package/build/src/flow.js +100 -96
- package/build/src/flow.js.map +1 -1
- package/build/src/libsaml.js +318 -261
- package/build/src/libsaml.js.map +1 -1
- package/build/src/metadata-idp.js +60 -30
- package/build/src/metadata-idp.js.map +1 -1
- package/build/src/metadata-sp.js +51 -41
- package/build/src/metadata-sp.js.map +1 -1
- package/build/src/metadata.js +47 -43
- package/build/src/metadata.js.map +1 -1
- package/build/src/options.js +73 -0
- package/build/src/options.js.map +1 -0
- package/build/src/urn.js +28 -1
- package/build/src/urn.js.map +1 -1
- package/build/src/utility.js +165 -83
- package/build/src/utility.js.map +1 -1
- package/build/src/validator.js +27 -10
- package/build/src/validator.js.map +1 -1
- package/package.json +17 -7
- package/types/src/api.d.ts +33 -3
- package/types/src/binding-post.d.ts +67 -34
- package/types/src/binding-redirect.d.ts +58 -31
- package/types/src/binding-simplesign.d.ts +77 -21
- package/types/src/entity-idp.d.ts +40 -31
- package/types/src/entity-sp.d.ts +37 -27
- package/types/src/entity.d.ts +71 -77
- package/types/src/extractor.d.ts +31 -22
- package/types/src/flow.d.ts +24 -2
- package/types/src/libsaml.d.ts +172 -118
- package/types/src/metadata-idp.d.ts +27 -11
- package/types/src/metadata-sp.d.ts +29 -19
- package/types/src/metadata.d.ts +59 -34
- package/types/src/options.d.ts +37 -0
- package/types/src/types.d.ts +250 -24
- package/types/src/urn.d.ts +7 -0
- package/types/src/utility.d.ts +144 -89
- package/types/src/validator.d.ts +21 -0
- package/.circleci/config.yml +0 -98
- package/.editorconfig +0 -19
- package/.github/FUNDING.yml +0 -1
- package/.github/workflows/deploy-docs.yml +0 -56
- package/.pre-commit.sh +0 -15
- package/.snyk +0 -4
- package/Makefile +0 -25
- package/index.ts +0 -28
- package/src/api.ts +0 -36
- package/src/binding-post.ts +0 -336
- package/src/binding-redirect.ts +0 -335
- package/src/binding-simplesign.ts +0 -231
- package/src/entity-idp.ts +0 -145
- package/src/entity-sp.ts +0 -114
- package/src/entity.ts +0 -243
- package/src/extractor.ts +0 -399
- package/src/flow.ts +0 -469
- package/src/libsaml.ts +0 -777
- package/src/metadata-idp.ts +0 -146
- package/src/metadata-sp.ts +0 -203
- package/src/metadata.ts +0 -166
- package/src/types.ts +0 -127
- package/src/urn.ts +0 -210
- package/src/utility.ts +0 -231
- package/src/validator.ts +0 -44
- package/tsconfig.json +0 -41
- package/tslint.json +0 -35
- package/types.d.ts +0 -2
- package/vitest.config.ts +0 -12
|
@@ -1,42 +1,75 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file binding-post.ts
|
|
3
|
-
* @author tngan
|
|
4
|
-
* @desc Binding-level API
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
* @file binding-post.ts
|
|
3
|
+
* @author tngan
|
|
4
|
+
* @desc Binding-level API for SAML HTTP-POST. Builds base64 login/logout
|
|
5
|
+
* request and response payloads that callers embed in an auto-submitting
|
|
6
|
+
* HTML form.
|
|
7
|
+
*/
|
|
8
|
+
import type { BindingContext, RequestInfo, SAMLUser } from './types';
|
|
9
|
+
import type { IdentityProvider as Idp } from './entity-idp';
|
|
10
|
+
import type { ServiceProvider as Sp } from './entity-sp';
|
|
11
|
+
import type Entity from './entity';
|
|
12
|
+
/** Shape passed to builder functions that need both IdP and SP handles. */
|
|
13
|
+
interface PostIdpSpPair {
|
|
14
|
+
idp: Idp;
|
|
15
|
+
sp: Sp;
|
|
16
|
+
}
|
|
17
|
+
/** Shape passed to builder functions for logout (initiator + target). */
|
|
18
|
+
interface PostInitTargetPair {
|
|
19
|
+
init: Entity;
|
|
20
|
+
target: Entity;
|
|
21
|
+
}
|
|
7
22
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
* Generate a base64-encoded AuthnRequest for the HTTP-POST binding.
|
|
24
|
+
*
|
|
25
|
+
* @param referenceTagXPath XPath used when signing the request
|
|
26
|
+
* @param entity `{ idp, sp }` handles
|
|
27
|
+
* @param customTagReplacement optional custom template transformer
|
|
28
|
+
* @param forceAuthn per-request `ForceAuthn` flag (saml-core §3.4.1)
|
|
29
|
+
* @param assertionConsumerServiceIndex per-request ACS index (saml-core §3.4.1).
|
|
30
|
+
* Mutually exclusive with `AssertionConsumerServiceURL` / `ProtocolBinding`;
|
|
31
|
+
* when supplied, both of those attributes are dropped from the rendered XML.
|
|
32
|
+
* @returns id / base64-XML pair
|
|
33
|
+
*/
|
|
34
|
+
declare function base64LoginRequest(referenceTagXPath: string, entity: PostIdpSpPair, customTagReplacement?: (template: string) => BindingContext, forceAuthn?: boolean, assertionConsumerServiceIndex?: number): BindingContext;
|
|
14
35
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
* Generate a base64-encoded login response for the HTTP-POST binding.
|
|
37
|
+
* Supports the sign-then-encrypt and encrypt-then-sign pipelines based on
|
|
38
|
+
* `encryptThenSign`.
|
|
39
|
+
*
|
|
40
|
+
* @param requestInfo parsed login request used to link `InResponseTo`
|
|
41
|
+
* @param entity `{ idp, sp }` handles
|
|
42
|
+
* @param user authenticated user
|
|
43
|
+
* @param customTagReplacement optional custom template transformer
|
|
44
|
+
* @param encryptThenSign when true, encrypt the assertion first then sign
|
|
45
|
+
* @returns id / base64-XML pair
|
|
46
|
+
*/
|
|
47
|
+
declare function base64LoginResponse(requestInfo: (RequestInfo | {
|
|
48
|
+
extract?: {
|
|
49
|
+
request?: {
|
|
50
|
+
id?: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}) | undefined, entity: PostIdpSpPair, user?: SAMLUser, customTagReplacement?: (template: string) => BindingContext, encryptThenSign?: boolean): Promise<BindingContext>;
|
|
23
54
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @
|
|
30
|
-
|
|
31
|
-
|
|
55
|
+
* Generate a base64-encoded LogoutRequest for the HTTP-POST binding.
|
|
56
|
+
*
|
|
57
|
+
* @param user currently authenticated user
|
|
58
|
+
* @param referenceTagXPath XPath used when signing the request
|
|
59
|
+
* @param entity `{ init, target }` handles
|
|
60
|
+
* @param customTagReplacement optional custom template transformer
|
|
61
|
+
* @returns id / base64-XML pair
|
|
62
|
+
*/
|
|
63
|
+
declare function base64LogoutRequest(user: SAMLUser, referenceTagXPath: string, entity: PostInitTargetPair, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
32
64
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
|
|
39
|
-
|
|
65
|
+
* Generate a base64-encoded LogoutResponse for the HTTP-POST binding.
|
|
66
|
+
*
|
|
67
|
+
* @param requestInfo parsed request used to link `InResponseTo`
|
|
68
|
+
* @param entity `{ init, target }` handles
|
|
69
|
+
* @param customTagReplacement optional custom template transformer
|
|
70
|
+
* @returns id / base64-XML pair
|
|
71
|
+
*/
|
|
72
|
+
declare function base64LogoutResponse(requestInfo: RequestInfo, entity: PostInitTargetPair, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
40
73
|
declare const postBinding: {
|
|
41
74
|
base64LoginRequest: typeof base64LoginRequest;
|
|
42
75
|
base64LoginResponse: typeof base64LoginResponse;
|
|
@@ -1,48 +1,75 @@
|
|
|
1
|
-
import { BindingContext } from './
|
|
2
|
-
import { IdentityProvider as Idp } from './entity-idp';
|
|
3
|
-
import { ServiceProvider as Sp } from './entity-sp';
|
|
1
|
+
import type { BindingContext, RequestInfo, SAMLUser } from './types';
|
|
2
|
+
import type { IdentityProvider as Idp } from './entity-idp';
|
|
3
|
+
import type { ServiceProvider as Sp } from './entity-sp';
|
|
4
|
+
import type Entity from './entity';
|
|
5
|
+
/** Options consumed by {@link buildRedirectURL}. */
|
|
4
6
|
export interface BuildRedirectConfig {
|
|
5
7
|
baseUrl: string;
|
|
6
8
|
type: string;
|
|
7
9
|
isSigned: boolean;
|
|
8
10
|
context: string;
|
|
9
|
-
entitySetting:
|
|
11
|
+
entitySetting: {
|
|
12
|
+
requestSignatureAlgorithm?: string;
|
|
13
|
+
privateKey?: string | Buffer;
|
|
14
|
+
privateKeyPass?: string;
|
|
15
|
+
};
|
|
10
16
|
relayState?: string;
|
|
11
17
|
}
|
|
18
|
+
/** Initiator/target entity pair used for logout redirects. */
|
|
19
|
+
interface RedirectInitTargetPair {
|
|
20
|
+
init: Entity;
|
|
21
|
+
target: Entity;
|
|
22
|
+
}
|
|
12
23
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @param
|
|
16
|
-
* @
|
|
17
|
-
|
|
24
|
+
* Build a redirect URL carrying a SAML AuthnRequest.
|
|
25
|
+
*
|
|
26
|
+
* @param entity `{ idp, sp }` handles
|
|
27
|
+
* @param customTagReplacement optional custom template transformer
|
|
28
|
+
* @param relayState per-request RelayState; falls back to `entitySetting.relayState`
|
|
29
|
+
* @param forceAuthn per-request `ForceAuthn` flag (saml-core §3.4.1)
|
|
30
|
+
* @param assertionConsumerServiceIndex per-request ACS index (saml-core §3.4.1).
|
|
31
|
+
* Mutually exclusive with `AssertionConsumerServiceURL` / `ProtocolBinding`;
|
|
32
|
+
* when supplied, both of those attributes are dropped from the rendered XML.
|
|
33
|
+
* @returns id + redirect URL wrapped in a {@link BindingContext}
|
|
34
|
+
*/
|
|
18
35
|
declare function loginRequestRedirectURL(entity: {
|
|
19
36
|
idp: Idp;
|
|
20
37
|
sp: Sp;
|
|
21
|
-
}, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
38
|
+
}, customTagReplacement?: (template: string) => BindingContext, relayState?: string, forceAuthn?: boolean, assertionConsumerServiceIndex?: number): BindingContext;
|
|
22
39
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
* Build a redirect URL carrying a SAML login Response.
|
|
41
|
+
*
|
|
42
|
+
* @param requestInfo parsed request used to link `InResponseTo`
|
|
43
|
+
* @param entity `{ idp, sp }` handles
|
|
44
|
+
* @param user authenticated user
|
|
45
|
+
* @param relayState caller-supplied redirect URL
|
|
46
|
+
* @param customTagReplacement optional custom template transformer
|
|
47
|
+
* @returns id + redirect URL wrapped in a {@link BindingContext}
|
|
48
|
+
*/
|
|
49
|
+
declare function loginResponseRedirectURL(requestInfo: RequestInfo, entity: {
|
|
50
|
+
idp: Idp;
|
|
51
|
+
sp: Sp;
|
|
52
|
+
}, user?: SAMLUser, relayState?: string, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
31
53
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @param
|
|
35
|
-
* @param
|
|
36
|
-
* @
|
|
37
|
-
|
|
38
|
-
|
|
54
|
+
* Build a redirect URL carrying a SAML LogoutRequest.
|
|
55
|
+
*
|
|
56
|
+
* @param user currently authenticated user
|
|
57
|
+
* @param entity `{ init, target }` handles
|
|
58
|
+
* @param relayState caller-supplied redirect URL
|
|
59
|
+
* @param customTagReplacement optional custom template transformer
|
|
60
|
+
* @returns id + redirect URL wrapped in a {@link BindingContext}
|
|
61
|
+
*/
|
|
62
|
+
declare function logoutRequestRedirectURL(user: SAMLUser, entity: RedirectInitTargetPair, relayState?: string, customTagReplacement?: (template: string, tags: object) => BindingContext): BindingContext;
|
|
39
63
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
44
|
-
|
|
45
|
-
|
|
64
|
+
* Build a redirect URL carrying a SAML LogoutResponse.
|
|
65
|
+
*
|
|
66
|
+
* @param requestInfo parsed request used to link `InResponseTo`
|
|
67
|
+
* @param entity `{ init, target }` handles
|
|
68
|
+
* @param relayState caller-supplied redirect URL
|
|
69
|
+
* @param customTagReplacement optional custom template transformer
|
|
70
|
+
* @returns id + redirect URL wrapped in a {@link BindingContext}
|
|
71
|
+
*/
|
|
72
|
+
declare function logoutResponseRedirectURL(requestInfo: RequestInfo, entity: RedirectInitTargetPair, relayState?: string, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
46
73
|
declare const redirectBinding: {
|
|
47
74
|
loginRequestRedirectURL: typeof loginRequestRedirectURL;
|
|
48
75
|
loginResponseRedirectURL: typeof loginResponseRedirectURL;
|
|
@@ -1,39 +1,95 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file binding-simplesign.ts
|
|
3
|
-
* @author Orange
|
|
4
|
-
* @desc Binding-level API
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
* @file binding-simplesign.ts
|
|
3
|
+
* @author Orange
|
|
4
|
+
* @desc Binding-level API for SAML HTTP-POST-SimpleSign. Produces base64
|
|
5
|
+
* payloads alongside a detached signature over the canonical octet string.
|
|
6
|
+
*/
|
|
7
|
+
import type { BindingContext, SimpleSignComputedContext, RequestInfo, SAMLUser } from './types';
|
|
8
|
+
import type { IdentityProvider as Idp } from './entity-idp';
|
|
9
|
+
import type { ServiceProvider as Sp } from './entity-sp';
|
|
10
|
+
import type Entity from './entity';
|
|
11
|
+
/** Options consumed by {@link buildSimpleSignature}. */
|
|
7
12
|
export interface BuildSimpleSignConfig {
|
|
8
13
|
type: string;
|
|
9
14
|
context: string;
|
|
10
|
-
entitySetting:
|
|
15
|
+
entitySetting: {
|
|
16
|
+
requestSignatureAlgorithm?: string;
|
|
17
|
+
privateKey?: string | Buffer;
|
|
18
|
+
privateKeyPass?: string;
|
|
19
|
+
};
|
|
11
20
|
relayState?: string;
|
|
12
21
|
}
|
|
22
|
+
/** Return value for login-response building with simple signatures. */
|
|
13
23
|
export interface BindingSimpleSignContext {
|
|
14
24
|
id: string;
|
|
15
25
|
context: string;
|
|
16
|
-
signature:
|
|
26
|
+
signature: string | Buffer;
|
|
17
27
|
sigAlg: string;
|
|
18
28
|
}
|
|
29
|
+
/** `{ idp, sp }` handle used by simple-sign builders. */
|
|
30
|
+
interface SimpleSignIdpSpPair {
|
|
31
|
+
idp: Idp;
|
|
32
|
+
sp: Sp;
|
|
33
|
+
}
|
|
34
|
+
/** `{ init, target }` handle used by simple-sign logout builders. */
|
|
35
|
+
interface SimpleSignInitTargetPair {
|
|
36
|
+
init: Entity;
|
|
37
|
+
target: Entity;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Generate a base64-encoded AuthnRequest together with a detached simple
|
|
41
|
+
* signature when the IdP advertises `WantAuthnRequestsSigned`.
|
|
42
|
+
*
|
|
43
|
+
* @param entity `{ idp, sp }` handles
|
|
44
|
+
* @param customTagReplacement optional custom template transformer
|
|
45
|
+
* @param relayState per-request RelayState; falls back to `entitySetting.relayState`
|
|
46
|
+
* @param forceAuthn per-request `ForceAuthn` flag (saml-core §3.4.1)
|
|
47
|
+
* @param assertionConsumerServiceIndex per-request ACS index (saml-core §3.4.1).
|
|
48
|
+
* Mutually exclusive with `AssertionConsumerServiceURL` / `ProtocolBinding`;
|
|
49
|
+
* when supplied, both of those attributes are dropped from the rendered XML.
|
|
50
|
+
*/
|
|
51
|
+
declare function base64LoginRequest(entity: SimpleSignIdpSpPair, customTagReplacement?: (template: string) => BindingContext, relayState?: string, forceAuthn?: boolean, assertionConsumerServiceIndex?: number): SimpleSignComputedContext;
|
|
52
|
+
/**
|
|
53
|
+
* Generate a base64-encoded login response together with a detached simple
|
|
54
|
+
* signature. Login responses are always signed under this binding.
|
|
55
|
+
*
|
|
56
|
+
* @param requestInfo parsed request used to link `InResponseTo`
|
|
57
|
+
* @param entity `{ idp, sp }` handles
|
|
58
|
+
* @param user authenticated user
|
|
59
|
+
* @param relayState caller-supplied redirect URL
|
|
60
|
+
* @param customTagReplacement optional custom template transformer
|
|
61
|
+
*/
|
|
62
|
+
declare function base64LoginResponse(requestInfo: (RequestInfo | {
|
|
63
|
+
extract?: {
|
|
64
|
+
request?: {
|
|
65
|
+
id?: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
}) | undefined, entity: SimpleSignIdpSpPair, user?: SAMLUser, relayState?: string, customTagReplacement?: (template: string) => BindingContext): Promise<BindingSimpleSignContext>;
|
|
19
69
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @param
|
|
24
|
-
|
|
25
|
-
|
|
70
|
+
* Generate a base64-encoded LogoutRequest together with a detached simple
|
|
71
|
+
* signature when the receiving entity requires signed logout requests.
|
|
72
|
+
*
|
|
73
|
+
* @param user currently authenticated user
|
|
74
|
+
* @param entity `{ init, target }` handles
|
|
75
|
+
* @param relayState caller-supplied redirect URL
|
|
76
|
+
* @param customTagReplacement optional custom template transformer
|
|
77
|
+
*/
|
|
78
|
+
declare function base64LogoutRequest(user: SAMLUser, entity: SimpleSignInitTargetPair, relayState?: string, customTagReplacement?: (template: string) => BindingContext): SimpleSignComputedContext;
|
|
26
79
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
33
|
-
|
|
34
|
-
|
|
80
|
+
* Generate a base64-encoded LogoutResponse together with a detached simple
|
|
81
|
+
* signature when the receiving entity requires signed logout responses.
|
|
82
|
+
*
|
|
83
|
+
* @param requestInfo parsed request used to link `InResponseTo`
|
|
84
|
+
* @param entity `{ init, target }` handles
|
|
85
|
+
* @param relayState caller-supplied redirect URL
|
|
86
|
+
* @param customTagReplacement optional custom template transformer
|
|
87
|
+
*/
|
|
88
|
+
declare function base64LogoutResponse(requestInfo: RequestInfo, entity: SimpleSignInitTargetPair, relayState?: string, customTagReplacement?: (template: string) => BindingContext): SimpleSignComputedContext;
|
|
35
89
|
declare const simpleSignBinding: {
|
|
36
90
|
base64LoginRequest: typeof base64LoginRequest;
|
|
37
91
|
base64LoginResponse: typeof base64LoginResponse;
|
|
92
|
+
base64LogoutRequest: typeof base64LogoutRequest;
|
|
93
|
+
base64LogoutResponse: typeof base64LogoutResponse;
|
|
38
94
|
};
|
|
39
95
|
export default simpleSignBinding;
|
|
@@ -1,42 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file entity-idp.ts
|
|
3
|
-
* @author tngan
|
|
4
|
-
* @desc
|
|
5
|
-
|
|
6
|
-
import Entity, { ESamlHttpRequest } from './entity';
|
|
7
|
-
import { ServiceProviderConstructor as ServiceProvider, IdentityProviderMetadata, IdentityProviderSettings } from './types';
|
|
8
|
-
import { FlowResult } from './flow';
|
|
9
|
-
import { BindingContext } from './entity';
|
|
10
|
-
/**
|
|
11
|
-
* Identity provider can be configured using either metadata importing or idpSetting
|
|
2
|
+
* @file entity-idp.ts
|
|
3
|
+
* @author tngan
|
|
4
|
+
* @desc Identity provider: builds login responses and parses inbound
|
|
5
|
+
* login requests coming from a service provider.
|
|
12
6
|
*/
|
|
13
|
-
|
|
7
|
+
import Entity from './entity';
|
|
8
|
+
import type { BindingContext, ESamlHttpRequest, PostBindingContext, SimpleSignBindingContext, RequestInfo, SAMLUser, IdentityProviderSettings, IdentityProviderMetadata, ServiceProviderConstructor as ServiceProvider, CreateLoginResponseOptions, CustomTagReplacement } from './types';
|
|
14
9
|
/**
|
|
15
|
-
*
|
|
10
|
+
* Factory returning a new {@link IdentityProvider}. An IdP can be built
|
|
11
|
+
* from an XML metadata document or from a programmatic settings object.
|
|
12
|
+
*
|
|
13
|
+
* @param props IdP settings
|
|
16
14
|
*/
|
|
15
|
+
export default function (props: IdentityProviderSettings): IdentityProvider;
|
|
16
|
+
/** Identity-provider entity. */
|
|
17
17
|
export declare class IdentityProvider extends Entity {
|
|
18
18
|
entityMeta: IdentityProviderMetadata;
|
|
19
|
+
/**
|
|
20
|
+
* Build an IdP, expanding `loginResponseTemplate.attributes` into a
|
|
21
|
+
* pre-baked AttributeStatement template when supplied.
|
|
22
|
+
*/
|
|
19
23
|
constructor(idpSetting: IdentityProviderSettings);
|
|
20
24
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
* Build a login response for delivery to the supplied service provider.
|
|
26
|
+
*
|
|
27
|
+
* The fifth parameter accepts either a callback (legacy positional shape)
|
|
28
|
+
* or an options bag `{ relayState?, customTagReplacement?, encryptThenSign? }`.
|
|
29
|
+
* When the legacy shape is used, the trailing `legacyEncryptThenSign` and
|
|
30
|
+
* `legacyRelayState` positional arguments are honoured. Per
|
|
31
|
+
* `saml-bindings §3.4.3 / §3.5.3`, RelayState is request-scoped — pass it
|
|
32
|
+
* via the options bag instead of `entitySetting.relayState`.
|
|
33
|
+
*
|
|
34
|
+
* @param sp target service provider
|
|
35
|
+
* @param requestInfo parsed request used to set `InResponseTo`
|
|
36
|
+
* @param binding `post`, `simpleSign`, or `redirect`
|
|
37
|
+
* @param user authenticated user
|
|
38
|
+
* @param optionsOrCallback per-request options or legacy custom-template callback
|
|
39
|
+
* @param legacyEncryptThenSign legacy positional `encryptThenSign`; ignored when options bag is used
|
|
40
|
+
* @param legacyRelayState legacy positional `relayState`; ignored when options bag is used
|
|
41
|
+
*/
|
|
42
|
+
createLoginResponse(sp: ServiceProvider, requestInfo: RequestInfo, binding: string, user: SAMLUser, optionsOrCallback?: CreateLoginResponseOptions | CustomTagReplacement, legacyEncryptThenSign?: boolean, legacyRelayState?: string): Promise<BindingContext | PostBindingContext | SimpleSignBindingContext>;
|
|
35
43
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
44
|
+
* Parse, validate and verify an inbound login request.
|
|
45
|
+
*
|
|
46
|
+
* @param sp service provider that produced the request
|
|
47
|
+
* @param binding `redirect`, `post`, or `simpleSign`
|
|
48
|
+
* @param req HTTP request envelope
|
|
40
49
|
*/
|
|
41
|
-
parseLoginRequest(sp: ServiceProvider, binding: string, req: ESamlHttpRequest): Promise<FlowResult>;
|
|
50
|
+
parseLoginRequest(sp: ServiceProvider, binding: string, req: ESamlHttpRequest): Promise<import("./flow").FlowResult>;
|
|
42
51
|
}
|
package/types/src/entity-sp.d.ts
CHANGED
|
@@ -1,36 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file entity-sp.ts
|
|
3
|
-
* @author tngan
|
|
4
|
-
* @desc
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
export default function (props: ServiceProviderSettings): ServiceProvider;
|
|
2
|
+
* @file entity-sp.ts
|
|
3
|
+
* @author tngan
|
|
4
|
+
* @desc Service provider: builds login requests and parses inbound login
|
|
5
|
+
* responses coming from an identity provider.
|
|
6
|
+
*/
|
|
7
|
+
import Entity from './entity';
|
|
8
|
+
import type { BindingContext, PostBindingContext, ESamlHttpRequest, SimpleSignBindingContext, IdentityProviderConstructor as IdentityProvider, ServiceProviderMetadata, ServiceProviderSettings, CreateLoginRequestOptions, CustomTagReplacement } from './types';
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
* Factory returning a new {@link ServiceProvider}. An SP can be built from
|
|
11
|
+
* an XML metadata document or from a programmatic settings object.
|
|
12
|
+
*
|
|
13
|
+
* @param props SP settings
|
|
14
|
+
*/
|
|
15
|
+
export default function (props: ServiceProviderSettings): ServiceProvider;
|
|
16
|
+
/** Service-provider entity. */
|
|
15
17
|
export declare class ServiceProvider extends Entity {
|
|
16
18
|
entityMeta: ServiceProviderMetadata;
|
|
17
19
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
* Build an SP with sensible defaults for signing flags.
|
|
21
|
+
*
|
|
22
|
+
* @param spSetting SP settings object
|
|
23
|
+
*/
|
|
21
24
|
constructor(spSetting: ServiceProviderSettings);
|
|
22
25
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
* Build a login request targeting the supplied identity provider.
|
|
27
|
+
*
|
|
28
|
+
* The third parameter accepts either a callback (legacy shape) or an
|
|
29
|
+
* options bag `{ relayState?, customTagReplacement? }`. Per
|
|
30
|
+
* `saml-bindings §3.4.3 / §3.5.3`, RelayState is request-scoped — pass
|
|
31
|
+
* it via the options bag instead of `entitySetting.relayState`.
|
|
32
|
+
*
|
|
33
|
+
* @param idp target identity provider
|
|
34
|
+
* @param binding `redirect` (default), `post`, or `simpleSign`
|
|
35
|
+
* @param optionsOrCallback per-request options or a custom-template callback
|
|
36
|
+
*/
|
|
37
|
+
createLoginRequest(idp: IdentityProvider, binding?: string, optionsOrCallback?: CreateLoginRequestOptions | CustomTagReplacement): BindingContext | PostBindingContext | SimpleSignBindingContext;
|
|
29
38
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
* Parse, validate and verify an inbound login response.
|
|
40
|
+
*
|
|
41
|
+
* @param idp identity provider that produced the response
|
|
42
|
+
* @param binding `redirect`, `post`, or `simpleSign`
|
|
43
|
+
* @param request HTTP request envelope
|
|
44
|
+
*/
|
|
45
|
+
parseLoginResponse(idp: IdentityProvider, binding: string, request: ESamlHttpRequest): Promise<import("./flow").FlowResult>;
|
|
36
46
|
}
|