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
package/types/src/utility.d.ts
CHANGED
|
@@ -1,120 +1,175 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Build an object by zipping two parallel arrays of keys and values.
|
|
3
|
+
* When `skipDuplicated` is false, colliding keys are aggregated into arrays
|
|
4
|
+
* so duplicate keys do not clobber earlier values.
|
|
5
|
+
*
|
|
6
|
+
* @param arr1 key array
|
|
7
|
+
* @param arr2 value array (same index as keys)
|
|
8
|
+
* @param skipDuplicated when true (default) later writes overwrite earlier ones
|
|
9
|
+
* @returns object composed from key/value pairs
|
|
5
10
|
*/
|
|
6
|
-
export declare function zipObject(arr1: string[], arr2:
|
|
11
|
+
export declare function zipObject<T>(arr1: string[], arr2: T[], skipDuplicated?: boolean): Record<string, T | T[]>;
|
|
7
12
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @param input
|
|
13
|
+
* Recursively flatten a nested array into a single-level array.
|
|
14
|
+
*
|
|
15
|
+
* @param input nested array input
|
|
16
|
+
* @returns flattened array
|
|
11
17
|
*/
|
|
12
|
-
export declare function flattenDeep(input:
|
|
18
|
+
export declare function flattenDeep<T>(input: T | T[]): T[];
|
|
13
19
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @param input
|
|
20
|
+
* Return the last element of an array.
|
|
21
|
+
*
|
|
22
|
+
* @param input source array
|
|
23
|
+
* @returns the final element, or undefined when the array is empty
|
|
17
24
|
*/
|
|
18
|
-
export declare function last(input:
|
|
25
|
+
export declare function last<T>(input: T[]): T;
|
|
19
26
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @param input
|
|
27
|
+
* Return a copy of a string array with duplicates removed.
|
|
28
|
+
*
|
|
29
|
+
* @param input array with possible duplicates
|
|
30
|
+
* @returns array in original order without duplicates
|
|
23
31
|
*/
|
|
24
32
|
export declare function uniq(input: string[]): string[];
|
|
25
33
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
34
|
+
* Safely read a dotted path from an object, returning `defaultValue` when
|
|
35
|
+
* any segment is missing.
|
|
36
|
+
*
|
|
37
|
+
* @param obj source object
|
|
38
|
+
* @param path dotted path expression (e.g. "a.b.c")
|
|
39
|
+
* @param defaultValue fallback when the path does not resolve
|
|
40
|
+
* @returns resolved value or the default
|
|
31
41
|
*/
|
|
32
|
-
export declare function get(obj:
|
|
42
|
+
export declare function get<T = unknown>(obj: Record<string, unknown> | null | undefined, path: string, defaultValue?: T | null): T | null;
|
|
33
43
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
44
|
+
* Type guard for strings.
|
|
45
|
+
*
|
|
46
|
+
* @param input value to test
|
|
47
|
+
* @returns true when the input is a string primitive
|
|
36
48
|
*/
|
|
37
|
-
export declare function isString(input:
|
|
49
|
+
export declare function isString(input: unknown): input is string;
|
|
38
50
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
42
|
-
|
|
51
|
+
* Encode a string or byte array as base64.
|
|
52
|
+
*
|
|
53
|
+
* @param message plain text or raw bytes
|
|
54
|
+
* @returns base64 encoded string
|
|
55
|
+
*/
|
|
43
56
|
declare function base64Encode(message: string | number[]): string;
|
|
44
57
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* @
|
|
49
|
-
|
|
58
|
+
* Decode a base64 message. Returns either the decoded string or the raw
|
|
59
|
+
* Buffer depending on `isBytes`.
|
|
60
|
+
*
|
|
61
|
+
* @param base64Message base64 encoded payload
|
|
62
|
+
* @param isBytes when true, return a Buffer instead of a string
|
|
63
|
+
* @returns decoded string or Buffer
|
|
64
|
+
*/
|
|
50
65
|
export declare function base64Decode(base64Message: string, isBytes?: boolean): string | Buffer;
|
|
51
66
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @
|
|
55
|
-
|
|
67
|
+
* Raw-deflate a UTF-8 string and return the compressed bytes.
|
|
68
|
+
*
|
|
69
|
+
* @param message plain text
|
|
70
|
+
* @returns compressed bytes as a number array
|
|
71
|
+
*/
|
|
56
72
|
declare function deflateString(message: string): number[];
|
|
57
73
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* @
|
|
61
|
-
|
|
74
|
+
* Raw-inflate a base64 string that was produced by {@link deflateString}.
|
|
75
|
+
*
|
|
76
|
+
* @param compressedString base64-encoded raw-deflate payload
|
|
77
|
+
* @returns decompressed UTF-8 string
|
|
78
|
+
*/
|
|
62
79
|
export declare function inflateString(compressedString: string): string;
|
|
63
80
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* @
|
|
67
|
-
|
|
81
|
+
* Normalise a PEM certificate string to its base64 body.
|
|
82
|
+
*
|
|
83
|
+
* @param certString PEM-encoded X.509 certificate
|
|
84
|
+
* @returns certificate body without headers/whitespace
|
|
85
|
+
*/
|
|
68
86
|
declare function normalizeCerString(certString: string | Buffer): string;
|
|
69
87
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* @
|
|
73
|
-
|
|
88
|
+
* Normalise a PEM RSA private key string to its base64 body.
|
|
89
|
+
*
|
|
90
|
+
* @param pemString PEM-encoded RSA private key
|
|
91
|
+
* @returns key body without headers/whitespace
|
|
92
|
+
*/
|
|
74
93
|
declare function normalizePemString(pemString: string | Buffer): string;
|
|
75
94
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
*
|
|
114
|
-
*/
|
|
115
|
-
|
|
95
|
+
* Reconstruct the full URL (protocol + host + path) from an Express-style
|
|
96
|
+
* HTTP request.
|
|
97
|
+
*
|
|
98
|
+
* @param req Express-compatible request object
|
|
99
|
+
* @returns absolute URL string
|
|
100
|
+
*/
|
|
101
|
+
declare function getFullURL(req: {
|
|
102
|
+
protocol: string;
|
|
103
|
+
get: (name: string) => string | undefined;
|
|
104
|
+
originalUrl: string;
|
|
105
|
+
}): string;
|
|
106
|
+
/**
|
|
107
|
+
* Return `str` when it is truthy, otherwise the provided default.
|
|
108
|
+
*/
|
|
109
|
+
declare function parseString(str: string | undefined | null, defaultValue?: string): string;
|
|
110
|
+
/**
|
|
111
|
+
* Shallow-merge `obj2` on top of `obj1`, returning a new object.
|
|
112
|
+
*/
|
|
113
|
+
declare function applyDefault<A extends object, B extends object>(obj1: A, obj2: B): A & B;
|
|
114
|
+
/**
|
|
115
|
+
* Extract the SPKI PEM public key from a base64 X.509 certificate body.
|
|
116
|
+
*
|
|
117
|
+
* @param x509Certificate normalised certificate body (no PEM wrappers)
|
|
118
|
+
* @returns PEM-encoded public key
|
|
119
|
+
*/
|
|
120
|
+
declare function getPublicKeyPemFromCertificate(x509Certificate: string): string | Buffer;
|
|
121
|
+
/**
|
|
122
|
+
* Read a PEM private key, optionally decrypting it with a passphrase.
|
|
123
|
+
*
|
|
124
|
+
* @param keyString PEM key contents
|
|
125
|
+
* @param passphrase optional passphrase protecting the key
|
|
126
|
+
* @param isOutputString when true, always return a string
|
|
127
|
+
* @returns PEM key as string or Buffer
|
|
128
|
+
*/
|
|
129
|
+
export declare function readPrivateKey(keyString: string | Buffer, passphrase: string | undefined, isOutputString?: boolean): string | Buffer;
|
|
130
|
+
/**
|
|
131
|
+
* Coerce a value to a string when `isOutputString` is true, otherwise pass
|
|
132
|
+
* it through untouched.
|
|
133
|
+
*/
|
|
134
|
+
declare function convertToString(input: string | Buffer, isOutputString?: boolean): string | Buffer;
|
|
135
|
+
/**
|
|
136
|
+
* Check that the input is an array with at least one element.
|
|
137
|
+
*
|
|
138
|
+
* @param a candidate value
|
|
139
|
+
* @returns true when the argument is a non-empty array
|
|
140
|
+
*/
|
|
141
|
+
export declare function isNonEmptyArray<T>(a: unknown): a is T[];
|
|
142
|
+
/**
|
|
143
|
+
* Wrap a single value in an array, or return the array unchanged.
|
|
144
|
+
* An undefined input returns an empty array.
|
|
145
|
+
*
|
|
146
|
+
* @param a scalar, array, or undefined
|
|
147
|
+
* @returns array form of the input
|
|
148
|
+
*/
|
|
116
149
|
export declare function castArrayOpt<T>(a?: T | T[]): T[];
|
|
150
|
+
/**
|
|
151
|
+
* Type guard removing `null` and `undefined` from a union.
|
|
152
|
+
*
|
|
153
|
+
* @param value value to narrow
|
|
154
|
+
* @returns true when the value is neither null nor undefined
|
|
155
|
+
*/
|
|
117
156
|
export declare function notEmpty<TValue>(value: TValue | null | undefined): value is TValue;
|
|
157
|
+
/**
|
|
158
|
+
* Escape a string for safe use inside an XPath single-quoted string literal.
|
|
159
|
+
* Prevents XPath injection by splitting on single quotes and using concat().
|
|
160
|
+
*
|
|
161
|
+
* @param value raw string that may contain quotes
|
|
162
|
+
* @returns XPath-safe string expression
|
|
163
|
+
*/
|
|
164
|
+
export declare function escapeXPathValue(value: string): string;
|
|
165
|
+
/**
|
|
166
|
+
* Convert a string to camelCase, splitting on whitespace, `-`, `_`, `.`,
|
|
167
|
+
* and inferred case boundaries.
|
|
168
|
+
*
|
|
169
|
+
* @param input source string
|
|
170
|
+
* @returns camelCased output
|
|
171
|
+
*/
|
|
172
|
+
export declare function camelCase(input: string): string;
|
|
118
173
|
declare const utility: {
|
|
119
174
|
isString: typeof isString;
|
|
120
175
|
base64Encode: typeof base64Encode;
|
package/types/src/validator.d.ts
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file validator.ts
|
|
3
|
+
* @author tngan
|
|
4
|
+
* @desc Time-window validators for SAML `NotBefore` / `NotOnOrAfter` conditions.
|
|
5
|
+
*/
|
|
6
|
+
/** Signed clock-drift tolerance in milliseconds for the two boundaries. */
|
|
1
7
|
type DriftTolerance = [number, number];
|
|
8
|
+
/**
|
|
9
|
+
* Check whether the current clock falls within the provided SAML time
|
|
10
|
+
* window, applying a symmetric drift tolerance to both ends.
|
|
11
|
+
*
|
|
12
|
+
* Behaviour:
|
|
13
|
+
* - Both bounds missing: logs a warning and returns `true`.
|
|
14
|
+
* - Only `utcNotBefore` given: returns true when now is at or after it.
|
|
15
|
+
* - Only `utcNotOnOrAfter` given: returns true when now is strictly before it.
|
|
16
|
+
* - Both given: returns true only when both individual checks pass.
|
|
17
|
+
*
|
|
18
|
+
* @param utcNotBefore ISO-8601 lower bound (inclusive) or undefined
|
|
19
|
+
* @param utcNotOnOrAfter ISO-8601 upper bound (exclusive) or undefined
|
|
20
|
+
* @param drift tolerance applied to each bound, defaults to `[0, 0]`
|
|
21
|
+
* @returns whether the current time is within the configured window
|
|
22
|
+
*/
|
|
2
23
|
declare function verifyTime(utcNotBefore: string | undefined, utcNotOnOrAfter: string | undefined, drift?: DriftTolerance): boolean;
|
|
3
24
|
export { verifyTime };
|
package/.circleci/config.yml
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
version: 2.1
|
|
2
|
-
|
|
3
|
-
jobs:
|
|
4
|
-
test-node-20:
|
|
5
|
-
docker:
|
|
6
|
-
- image: cimg/node:20.0
|
|
7
|
-
environment:
|
|
8
|
-
INSTALL_JDK: 1
|
|
9
|
-
steps:
|
|
10
|
-
- checkout
|
|
11
|
-
- run:
|
|
12
|
-
name: Install Java JDK 20
|
|
13
|
-
command: |
|
|
14
|
-
sudo apt-get update
|
|
15
|
-
sudo apt-get install -y wget lsb-release
|
|
16
|
-
sudo mkdir -p /etc/apt/keyrings
|
|
17
|
-
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo tee /etc/apt/keyrings/adoptium.asc
|
|
18
|
-
echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
|
|
19
|
-
sudo apt-get update
|
|
20
|
-
sudo apt-get install -y temurin-20-jdk
|
|
21
|
-
java -version
|
|
22
|
-
javac -version
|
|
23
|
-
- run:
|
|
24
|
-
name: Install dependencies
|
|
25
|
-
command: yarn install --production=true
|
|
26
|
-
- run:
|
|
27
|
-
name: Install test dependencies
|
|
28
|
-
command: yarn add @authenio/samlify-xsd-schema-validator
|
|
29
|
-
- run:
|
|
30
|
-
name: Run tests
|
|
31
|
-
command: yarn test
|
|
32
|
-
|
|
33
|
-
test-node-22:
|
|
34
|
-
docker:
|
|
35
|
-
- image: cimg/node:22.0
|
|
36
|
-
environment:
|
|
37
|
-
INSTALL_JDK: 1
|
|
38
|
-
steps:
|
|
39
|
-
- checkout
|
|
40
|
-
- run:
|
|
41
|
-
name: Install Java JDK 20
|
|
42
|
-
command: |
|
|
43
|
-
sudo apt-get update
|
|
44
|
-
sudo apt-get install -y wget lsb-release
|
|
45
|
-
sudo mkdir -p /etc/apt/keyrings
|
|
46
|
-
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo tee /etc/apt/keyrings/adoptium.asc
|
|
47
|
-
echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
|
|
48
|
-
sudo apt-get update
|
|
49
|
-
sudo apt-get install -y temurin-20-jdk
|
|
50
|
-
java -version
|
|
51
|
-
javac -version
|
|
52
|
-
- run:
|
|
53
|
-
name: Install dependencies
|
|
54
|
-
command: yarn install --production=true
|
|
55
|
-
- run:
|
|
56
|
-
name: Install test dependencies
|
|
57
|
-
command: yarn add @authenio/samlify-xsd-schema-validator
|
|
58
|
-
- run:
|
|
59
|
-
name: Run tests
|
|
60
|
-
command: yarn test
|
|
61
|
-
|
|
62
|
-
test-node-24:
|
|
63
|
-
docker:
|
|
64
|
-
- image: cimg/node:24.0
|
|
65
|
-
environment:
|
|
66
|
-
INSTALL_JDK: 1
|
|
67
|
-
steps:
|
|
68
|
-
- checkout
|
|
69
|
-
- run:
|
|
70
|
-
name: Install Java JDK 20
|
|
71
|
-
command: |
|
|
72
|
-
sudo apt-get update
|
|
73
|
-
sudo apt-get install -y wget lsb-release
|
|
74
|
-
sudo mkdir -p /etc/apt/keyrings
|
|
75
|
-
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo tee /etc/apt/keyrings/adoptium.asc
|
|
76
|
-
echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
|
|
77
|
-
sudo apt-get update
|
|
78
|
-
sudo apt-get install -y temurin-20-jdk
|
|
79
|
-
java -version
|
|
80
|
-
javac -version
|
|
81
|
-
- run:
|
|
82
|
-
name: Install dependencies
|
|
83
|
-
command: yarn install --production=true
|
|
84
|
-
- run:
|
|
85
|
-
name: Install test dependencies
|
|
86
|
-
command: yarn add @authenio/samlify-xsd-schema-validator
|
|
87
|
-
- run:
|
|
88
|
-
name: Run tests
|
|
89
|
-
command: yarn test
|
|
90
|
-
|
|
91
|
-
workflows:
|
|
92
|
-
version: 2
|
|
93
|
-
test:
|
|
94
|
-
jobs:
|
|
95
|
-
- test-node-20
|
|
96
|
-
- test-node-22
|
|
97
|
-
- test-node-24
|
|
98
|
-
|
package/.editorconfig
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*]
|
|
4
|
-
indent_style = tab
|
|
5
|
-
end_of_line = lf
|
|
6
|
-
charset = utf-8
|
|
7
|
-
trim_trailing_whitespace = true
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
|
|
10
|
-
[*.{json,js,ts,jsx,html,css}]
|
|
11
|
-
indent_style = space
|
|
12
|
-
indent_size = 2
|
|
13
|
-
|
|
14
|
-
[.eslintrc]
|
|
15
|
-
indent_style = space
|
|
16
|
-
indent_size = 2
|
|
17
|
-
|
|
18
|
-
[*.md]
|
|
19
|
-
trim_trailing_whitespace = false
|
package/.github/FUNDING.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
github: [tngan]
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
name: Deploy VitePress Docs
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- master
|
|
7
|
-
paths:
|
|
8
|
-
- 'docs/**'
|
|
9
|
-
- '.github/workflows/deploy-docs.yml'
|
|
10
|
-
workflow_dispatch:
|
|
11
|
-
|
|
12
|
-
permissions:
|
|
13
|
-
contents: read
|
|
14
|
-
pages: write
|
|
15
|
-
id-token: write
|
|
16
|
-
|
|
17
|
-
concurrency:
|
|
18
|
-
group: pages
|
|
19
|
-
cancel-in-progress: false
|
|
20
|
-
|
|
21
|
-
jobs:
|
|
22
|
-
build-and-deploy:
|
|
23
|
-
runs-on: ubuntu-latest
|
|
24
|
-
environment:
|
|
25
|
-
name: github-pages
|
|
26
|
-
url: ${{ steps.deployment.outputs.page_url }}
|
|
27
|
-
steps:
|
|
28
|
-
- name: Checkout
|
|
29
|
-
uses: actions/checkout@v4
|
|
30
|
-
with:
|
|
31
|
-
fetch-depth: 0
|
|
32
|
-
|
|
33
|
-
- name: Setup Node.js
|
|
34
|
-
uses: actions/setup-node@v4
|
|
35
|
-
with:
|
|
36
|
-
node-version: 18
|
|
37
|
-
cache: 'yarn'
|
|
38
|
-
|
|
39
|
-
- name: Install dependencies
|
|
40
|
-
run: yarn install --frozen-lockfile
|
|
41
|
-
|
|
42
|
-
- name: Build VitePress
|
|
43
|
-
run: yarn docs:build
|
|
44
|
-
|
|
45
|
-
- name: Setup Pages
|
|
46
|
-
uses: actions/configure-pages@v4
|
|
47
|
-
|
|
48
|
-
- name: Upload artifact
|
|
49
|
-
uses: actions/upload-pages-artifact@v3
|
|
50
|
-
with:
|
|
51
|
-
path: docs/.vitepress/dist
|
|
52
|
-
|
|
53
|
-
- name: Deploy to GitHub Pages
|
|
54
|
-
id: deployment
|
|
55
|
-
uses: actions/deploy-pages@v4
|
|
56
|
-
|
package/.pre-commit.sh
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
echo "Linting"
|
|
2
|
-
npm run lint
|
|
3
|
-
LINTRESULT=$?
|
|
4
|
-
|
|
5
|
-
echo "Compiling"
|
|
6
|
-
$(npm bin)/tsc
|
|
7
|
-
BUILDRESULT=$?
|
|
8
|
-
|
|
9
|
-
if [[ $LINTRESULT -ne 0 || $BUILDRESULT -ne 0 ]]; then
|
|
10
|
-
echo "Fix errors before commit"
|
|
11
|
-
exit 1
|
|
12
|
-
else
|
|
13
|
-
echo "Ok to commit"
|
|
14
|
-
exit 0
|
|
15
|
-
fi
|
package/.snyk
DELETED
package/Makefile
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
PROJECT = "samlify"
|
|
2
|
-
|
|
3
|
-
install: ;@echo "install ${PROJECT}"; \
|
|
4
|
-
npm install;
|
|
5
|
-
|
|
6
|
-
clean: ;
|
|
7
|
-
rm -rf node_modules
|
|
8
|
-
|
|
9
|
-
rebuild: ;
|
|
10
|
-
rm -rf build; \
|
|
11
|
-
tsc; \
|
|
12
|
-
|
|
13
|
-
pretest: ;
|
|
14
|
-
mkdir -p build/test; \
|
|
15
|
-
cp -a test/key test/misc build/test;
|
|
16
|
-
|
|
17
|
-
install_jdk:
|
|
18
|
-
sudo add-apt-repository ppa:openjdk-r/ppa -y
|
|
19
|
-
sudo apt-get -qq update
|
|
20
|
-
sudo apt-get install -y openjdk-9-jdk
|
|
21
|
-
|
|
22
|
-
doc: ;@echo "prepare and serve the docs"; \
|
|
23
|
-
docsify serve ./docs
|
|
24
|
-
|
|
25
|
-
.PHONY: rebuild pretest doc install_jdk
|
package/index.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// version <= 1.25
|
|
2
|
-
import IdentityProvider, { IdentityProvider as IdentityProviderInstance } from './src/entity-idp';
|
|
3
|
-
import ServiceProvider, { ServiceProvider as ServiceProviderInstance } from './src/entity-sp';
|
|
4
|
-
|
|
5
|
-
export { default as IdPMetadata } from './src/metadata-idp';
|
|
6
|
-
export { default as SPMetadata } from './src/metadata-sp';
|
|
7
|
-
export { default as Utility } from './src/utility';
|
|
8
|
-
export { default as SamlLib } from './src/libsaml';
|
|
9
|
-
// roadmap
|
|
10
|
-
// new name convention in version >= 3.0
|
|
11
|
-
import * as Constants from './src/urn';
|
|
12
|
-
import * as Extractor from './src/extractor';
|
|
13
|
-
|
|
14
|
-
// exposed methods for customizing samlify
|
|
15
|
-
import { setSchemaValidator, setDOMParserOptions } from './src/api';
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
Constants,
|
|
19
|
-
Extractor,
|
|
20
|
-
// temp: resolve the conflict after version >= 3.0
|
|
21
|
-
IdentityProvider,
|
|
22
|
-
IdentityProviderInstance,
|
|
23
|
-
ServiceProvider,
|
|
24
|
-
ServiceProviderInstance,
|
|
25
|
-
// set context
|
|
26
|
-
setSchemaValidator,
|
|
27
|
-
setDOMParserOptions
|
|
28
|
-
};
|
package/src/api.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { DOMParser as dom, Options as DOMParserOptions } from '@xmldom/xmldom';
|
|
2
|
-
|
|
3
|
-
// global module configuration
|
|
4
|
-
interface Context extends ValidatorContext, DOMParserContext {}
|
|
5
|
-
|
|
6
|
-
interface ValidatorContext {
|
|
7
|
-
validate?: (xml: string) => Promise<any>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface DOMParserContext {
|
|
11
|
-
dom: dom;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const context: Context = {
|
|
15
|
-
validate: undefined,
|
|
16
|
-
dom: new dom()
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export function getContext() {
|
|
20
|
-
return context;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function setSchemaValidator(params: ValidatorContext) {
|
|
24
|
-
|
|
25
|
-
if (typeof params.validate !== 'function') {
|
|
26
|
-
throw new Error('validate must be a callback function having one argument as xml input');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// assign the validate function to the context
|
|
30
|
-
context.validate = params.validate;
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function setDOMParserOptions(options: DOMParserOptions = {}) {
|
|
35
|
-
context.dom = new dom(options);
|
|
36
|
-
}
|