samlesa 2.12.3 → 2.12.6
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.
Potentially problematic release.
This version of samlesa might be problematic. Click here for more details.
- package/build/index.js +54 -64
- package/build/index.js.map +1 -1
- package/build/src/api.js +24 -23
- package/build/src/api.js.map +1 -1
- package/build/src/binding-post.js +358 -368
- package/build/src/binding-post.js.map +1 -1
- package/build/src/binding-redirect.js +333 -332
- package/build/src/binding-redirect.js.map +1 -1
- package/build/src/binding-simplesign.js +222 -232
- package/build/src/binding-simplesign.js.map +1 -1
- package/build/src/entity-idp.js +132 -130
- package/build/src/entity-idp.js.map +1 -1
- package/build/src/entity-sp.js +96 -96
- package/build/src/entity-sp.js.map +1 -1
- package/build/src/entity.js +225 -235
- package/build/src/entity.js.map +1 -1
- package/build/src/extractor.js +369 -369
- package/build/src/extractor.js.map +1 -1
- package/build/src/flow.js +320 -319
- package/build/src/flow.js.map +1 -1
- package/build/src/libsaml.js +660 -641
- package/build/src/libsaml.js.map +1 -1
- package/build/src/metadata-idp.js +127 -127
- package/build/src/metadata-idp.js.map +1 -1
- package/build/src/metadata-sp.js +231 -231
- package/build/src/metadata-sp.js.map +1 -1
- package/build/src/metadata.js +166 -176
- package/build/src/metadata.js.map +1 -1
- package/build/src/types.js +11 -11
- package/build/src/urn.js +212 -212
- package/build/src/urn.js.map +1 -1
- package/build/src/utility.js +292 -248
- package/build/src/utility.js.map +1 -1
- package/build/src/validator.js +27 -26
- package/build/src/validator.js.map +1 -1
- package/index.d.ts +10 -10
- package/index.js +18 -18
- package/package.json +1 -5
- package/qodana.yaml +29 -29
- package/src/binding-post.ts +1 -1
- package/src/binding-redirect.ts +83 -64
- package/src/entity-idp.ts +26 -20
- package/src/libsaml.ts +79 -48
- package/src/utility.ts +147 -76
- package/types/index.d.ts +10 -10
- package/types/src/api.d.ts +13 -13
- package/types/src/binding-post.d.ts +46 -46
- package/types/src/binding-redirect.d.ts +52 -52
- package/types/src/binding-simplesign.d.ts +39 -39
- package/types/src/entity-idp.d.ts +35 -42
- package/types/src/entity-sp.d.ts +36 -36
- package/types/src/entity.d.ts +101 -99
- package/types/src/extractor.d.ts +25 -25
- package/types/src/flow.d.ts +6 -6
- package/types/src/libsaml.d.ts +200 -210
- package/types/src/metadata-idp.d.ts +24 -24
- package/types/src/metadata-sp.d.ts +36 -36
- package/types/src/metadata.d.ts +59 -57
- package/types/src/types.d.ts +129 -127
- package/types/src/urn.d.ts +194 -194
- package/types/src/utility.d.ts +134 -134
- package/types/src/validator.d.ts +3 -3
- package/.idea/compiler.xml +0 -6
- package/.idea/deployment.xml +0 -14
- package/.idea/jsLibraryMappings.xml +0 -6
- package/build/.idea/workspace.xml +0 -58
package/src/utility.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file utility.ts
|
|
3
|
-
* @author tngan
|
|
4
|
-
* @desc Library for some common functions (e.g. de/inflation, en/decoding)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {
|
|
2
|
+
* @file utility.ts
|
|
3
|
+
* @author tngan
|
|
4
|
+
* @desc Library for some common functions (e.g. de/inflation, en/decoding)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {X509Certificate,createPrivateKey } from 'node:crypto';
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {inflate, deflate} from 'pako';
|
|
11
11
|
|
|
12
12
|
const BASE64_STR = 'base64';
|
|
13
13
|
|
|
@@ -36,6 +36,7 @@ export function zipObject(arr1: string[], arr2: any[], skipDuplicated = true) {
|
|
|
36
36
|
|
|
37
37
|
}, {});
|
|
38
38
|
}
|
|
39
|
+
|
|
39
40
|
/**
|
|
40
41
|
* @desc Alternative to lodash.flattenDeep
|
|
41
42
|
* @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_flattendeep
|
|
@@ -43,9 +44,10 @@ export function zipObject(arr1: string[], arr2: any[], skipDuplicated = true) {
|
|
|
43
44
|
*/
|
|
44
45
|
export function flattenDeep(input: any[]) {
|
|
45
46
|
return Array.isArray(input)
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
? input.reduce((a, b) => a.concat(flattenDeep(b)), [])
|
|
48
|
+
: [input];
|
|
48
49
|
}
|
|
50
|
+
|
|
49
51
|
/**
|
|
50
52
|
* @desc Alternative to lodash.last
|
|
51
53
|
* @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_last
|
|
@@ -54,6 +56,7 @@ export function flattenDeep(input: any[]) {
|
|
|
54
56
|
export function last(input: any[]) {
|
|
55
57
|
return input.slice(-1)[0];
|
|
56
58
|
}
|
|
59
|
+
|
|
57
60
|
/**
|
|
58
61
|
* @desc Alternative to lodash.uniq
|
|
59
62
|
* @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_uniq
|
|
@@ -61,8 +64,9 @@ export function last(input: any[]) {
|
|
|
61
64
|
*/
|
|
62
65
|
export function uniq(input: string[]) {
|
|
63
66
|
const set = new Set(input);
|
|
64
|
-
return [...
|
|
67
|
+
return [...set];
|
|
65
68
|
}
|
|
69
|
+
|
|
66
70
|
/**
|
|
67
71
|
* @desc Alternative to lodash.get
|
|
68
72
|
* @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_get
|
|
@@ -72,8 +76,9 @@ export function uniq(input: string[]) {
|
|
|
72
76
|
*/
|
|
73
77
|
export function get(obj, path, defaultValue) {
|
|
74
78
|
return path.split('.')
|
|
75
|
-
|
|
79
|
+
.reduce((a, c) => (a && a[c] ? a[c] : (defaultValue || null)), obj);
|
|
76
80
|
}
|
|
81
|
+
|
|
77
82
|
/**
|
|
78
83
|
* @desc Check if the input is string
|
|
79
84
|
* @param {any} input
|
|
@@ -81,107 +86,123 @@ export function get(obj, path, defaultValue) {
|
|
|
81
86
|
export function isString(input: any) {
|
|
82
87
|
return typeof input === 'string';
|
|
83
88
|
}
|
|
89
|
+
|
|
84
90
|
/**
|
|
85
|
-
* @desc Encode string with base64 format
|
|
86
|
-
* @param {string} message plain-text message
|
|
87
|
-
* @return {string} base64 encoded string
|
|
88
|
-
*/
|
|
91
|
+
* @desc Encode string with base64 format
|
|
92
|
+
* @param {string} message plain-text message
|
|
93
|
+
* @return {string} base64 encoded string
|
|
94
|
+
*/
|
|
89
95
|
function base64Encode(message: string | number[]) {
|
|
90
96
|
return Buffer.from(message as string).toString(BASE64_STR);
|
|
91
97
|
}
|
|
98
|
+
|
|
92
99
|
/**
|
|
93
|
-
* @desc Decode string from base64 format
|
|
94
|
-
* @param {string} base64Message encoded string
|
|
95
|
-
* @param {boolean} isBytes determine the return value type (True: bytes False: string)
|
|
96
|
-
* @return {bytes/string} decoded bytes/string depends on isBytes, default is {string}
|
|
97
|
-
*/
|
|
100
|
+
* @desc Decode string from base64 format
|
|
101
|
+
* @param {string} base64Message encoded string
|
|
102
|
+
* @param {boolean} isBytes determine the return value type (True: bytes False: string)
|
|
103
|
+
* @return {bytes/string} decoded bytes/string depends on isBytes, default is {string}
|
|
104
|
+
*/
|
|
98
105
|
export function base64Decode(base64Message: string, isBytes?: boolean): string | Buffer {
|
|
99
106
|
const bytes = Buffer.from(base64Message, BASE64_STR);
|
|
100
107
|
return Boolean(isBytes) ? bytes : bytes.toString();
|
|
101
108
|
}
|
|
109
|
+
|
|
102
110
|
/**
|
|
103
|
-
* @desc Compress the string
|
|
104
|
-
* @param {string} message
|
|
105
|
-
* @return {string} compressed string
|
|
106
|
-
*/
|
|
111
|
+
* @desc Compress the string
|
|
112
|
+
* @param {string} message
|
|
113
|
+
* @return {string} compressed string
|
|
114
|
+
*/
|
|
107
115
|
function deflateString(message: string): number[] {
|
|
108
116
|
const input = Array.prototype.map.call(message, char => char.charCodeAt(0));
|
|
109
|
-
return Array.from(deflate(input, {
|
|
117
|
+
return Array.from(deflate(input, {raw: true}));
|
|
110
118
|
}
|
|
119
|
+
|
|
111
120
|
/**
|
|
112
|
-
* @desc Decompress the compressed string
|
|
113
|
-
* @param {string} compressedString
|
|
114
|
-
* @return {string} decompressed string
|
|
115
|
-
*/
|
|
121
|
+
* @desc Decompress the compressed string
|
|
122
|
+
* @param {string} compressedString
|
|
123
|
+
* @return {string} decompressed string
|
|
124
|
+
*/
|
|
116
125
|
export function inflateString(compressedString: string): string {
|
|
117
126
|
const inputBuffer = Buffer.from(compressedString, BASE64_STR);
|
|
118
127
|
const input = Array.prototype.map.call(inputBuffer.toString('binary'), char => char.charCodeAt(0));
|
|
119
|
-
return Array.from(inflate(input, {
|
|
128
|
+
return Array.from(inflate(input, {raw: true}))
|
|
120
129
|
.map((byte: number) => String.fromCharCode(byte))
|
|
121
130
|
.join('');
|
|
122
131
|
}
|
|
132
|
+
|
|
123
133
|
/**
|
|
124
|
-
* @desc Abstract the normalizeCerString and normalizePemString
|
|
125
|
-
* @param {buffer} File stream or string
|
|
126
|
-
* @param {string} String for header and tail
|
|
127
|
-
* @return {string} A formatted certificate string
|
|
128
|
-
*/
|
|
134
|
+
* @desc Abstract the normalizeCerString and normalizePemString
|
|
135
|
+
* @param {buffer} File stream or string
|
|
136
|
+
* @param {string} String for header and tail
|
|
137
|
+
* @return {string} A formatted certificate string
|
|
138
|
+
*/
|
|
129
139
|
function _normalizeCerString(bin: string | Buffer, format: string) {
|
|
130
140
|
return bin.toString().replace(/\n/g, '').replace(/\r/g, '').replace(`-----BEGIN ${format}-----`, '').replace(`-----END ${format}-----`, '').replace(/ /g, '').replace(/\t/g, '');
|
|
131
141
|
}
|
|
142
|
+
|
|
132
143
|
/**
|
|
133
|
-
* @desc Parse the .cer to string format without line break, header and footer
|
|
134
|
-
* @param {string} certString declares the certificate contents
|
|
135
|
-
* @return {string} certificiate in string format
|
|
136
|
-
*/
|
|
144
|
+
* @desc Parse the .cer to string format without line break, header and footer
|
|
145
|
+
* @param {string} certString declares the certificate contents
|
|
146
|
+
* @return {string} certificiate in string format
|
|
147
|
+
*/
|
|
137
148
|
function normalizeCerString(certString: string | Buffer) {
|
|
138
149
|
return _normalizeCerString(certString, 'CERTIFICATE');
|
|
139
150
|
}
|
|
151
|
+
|
|
140
152
|
/**
|
|
141
|
-
* @desc Normalize the string in .pem format without line break, header and footer
|
|
142
|
-
* @param {string} pemString
|
|
143
|
-
* @return {string} private key in string format
|
|
144
|
-
*/
|
|
153
|
+
* @desc Normalize the string in .pem format without line break, header and footer
|
|
154
|
+
* @param {string} pemString
|
|
155
|
+
* @return {string} private key in string format
|
|
156
|
+
*/
|
|
145
157
|
function normalizePemString(pemString: string | Buffer) {
|
|
146
158
|
return _normalizeCerString(pemString.toString(), 'RSA PRIVATE KEY');
|
|
147
159
|
}
|
|
160
|
+
|
|
148
161
|
/**
|
|
149
|
-
* @desc Return the complete URL
|
|
150
|
-
* @param {object} req HTTP request
|
|
151
|
-
* @return {string} URL
|
|
152
|
-
*/
|
|
162
|
+
* @desc Return the complete URL
|
|
163
|
+
* @param {object} req HTTP request
|
|
164
|
+
* @return {string} URL
|
|
165
|
+
*/
|
|
153
166
|
function getFullURL(req) {
|
|
154
167
|
return `${req.protocol}://${req.get('host')}${req.originalUrl}`;
|
|
155
168
|
}
|
|
169
|
+
|
|
156
170
|
/**
|
|
157
|
-
* @desc Parse input string, return default value if it is undefined
|
|
158
|
-
* @param {string/boolean}
|
|
159
|
-
* @return {boolean}
|
|
160
|
-
*/
|
|
171
|
+
* @desc Parse input string, return default value if it is undefined
|
|
172
|
+
* @param {string/boolean}
|
|
173
|
+
* @return {boolean}
|
|
174
|
+
*/
|
|
161
175
|
function parseString(str, defaultValue = '') {
|
|
162
176
|
return str || defaultValue;
|
|
163
177
|
}
|
|
178
|
+
|
|
164
179
|
/**
|
|
165
|
-
* @desc Override the object by another object (rtl)
|
|
166
|
-
* @param {object} default object
|
|
167
|
-
* @param {object} object applied to the default object
|
|
168
|
-
* @return {object} result object
|
|
169
|
-
*/
|
|
180
|
+
* @desc Override the object by another object (rtl)
|
|
181
|
+
* @param {object} default object
|
|
182
|
+
* @param {object} object applied to the default object
|
|
183
|
+
* @return {object} result object
|
|
184
|
+
*/
|
|
170
185
|
function applyDefault(obj1, obj2) {
|
|
171
186
|
return Object.assign({}, obj1, obj2);
|
|
172
187
|
}
|
|
188
|
+
|
|
173
189
|
/**
|
|
174
|
-
* @desc Get public key in pem format from the certificate included in the metadata
|
|
175
|
-
* @param {string} x509 certificate
|
|
176
|
-
* @return {string} public key fetched from the certificate
|
|
177
|
-
*/
|
|
190
|
+
* @desc Get public key in pem format from the certificate included in the metadata
|
|
191
|
+
* @param {string} x509 certificate
|
|
192
|
+
* @return {string} public key fetched from the certificate
|
|
193
|
+
*/
|
|
178
194
|
function getPublicKeyPemFromCertificate(x509CertificateString: string) {
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
195
|
+
const derBuffer = Buffer.from(x509CertificateString, 'base64');
|
|
196
|
+
// 解析 X.509 证书
|
|
197
|
+
const cert2 = new X509Certificate(derBuffer);
|
|
198
|
+
const publicKeyObject = cert2.publicKey
|
|
199
|
+
// 3. 导出为 PEM 格式
|
|
200
|
+
return publicKeyObject.export({
|
|
201
|
+
type: 'spki', // 使用 Subject Public Key Info 结构
|
|
202
|
+
format: 'pem' // 输出 PEM 格式
|
|
203
|
+
});
|
|
184
204
|
|
|
205
|
+
}
|
|
185
206
|
|
|
186
207
|
|
|
187
208
|
/*function getPublicKeyPemFromCertificate(x509Certificate: string): string {
|
|
@@ -197,25 +218,75 @@ function getPublicKeyPemFromCertificate(x509CertificateString: string) {
|
|
|
197
218
|
return cert.publicKey?.toString();
|
|
198
219
|
}*/
|
|
199
220
|
/**
|
|
200
|
-
* @desc Read private key from pem-formatted string
|
|
201
|
-
* @param {string | Buffer} keyString pem-formatted string
|
|
202
|
-
* @param {string} protected passphrase of the key
|
|
203
|
-
* @return {string} string in pem format
|
|
204
|
-
* If passphrase is used to protect the .pem content (recommend)
|
|
205
|
-
*/
|
|
206
|
-
|
|
207
|
-
|
|
221
|
+
* @desc Read private key from pem-formatted string
|
|
222
|
+
* @param {string | Buffer} keyString pem-formatted string
|
|
223
|
+
* @param {string} protected passphrase of the key
|
|
224
|
+
* @return {string} string in pem format
|
|
225
|
+
* If passphrase is used to protect the .pem content (recommend)
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* PEM 头尾格式校验与修复
|
|
230
|
+
*/
|
|
231
|
+
function validatePEMHeaders(pem: string, keyType: string): string {
|
|
232
|
+
const expectedHeader = `-----BEGIN ${keyType}-----`;
|
|
233
|
+
const expectedFooter = `-----END ${keyType}-----`;
|
|
234
|
+
|
|
235
|
+
// 自动修复不规范的 PEM 头尾
|
|
236
|
+
return pem
|
|
237
|
+
.replace(/-{5}.*PRIVATE KEY-{5}/g, '') // 清除已有头尾
|
|
238
|
+
.replace(/(\r\n|\n|\r)/gm, '\n') // 统一换行符
|
|
239
|
+
.trim() + // 清理空白
|
|
240
|
+
`\n${expectedHeader}\n${pem}\n${expectedFooter}\n`;
|
|
208
241
|
}
|
|
242
|
+
export function readPrivateKey(
|
|
243
|
+
keyString: string | Buffer,
|
|
244
|
+
passphrase?: string,
|
|
245
|
+
isOutputString: boolean = true
|
|
246
|
+
): string | Buffer {
|
|
247
|
+
try {
|
|
248
|
+
// 统一转换为字符串格式处理
|
|
249
|
+
const pemKey = Buffer.isBuffer(keyString)
|
|
250
|
+
? keyString.toString('utf8')
|
|
251
|
+
: keyString;
|
|
252
|
+
|
|
253
|
+
// 创建私钥对象 (自动处理加密)
|
|
254
|
+
const keyObject = createPrivateKey({
|
|
255
|
+
key: pemKey,
|
|
256
|
+
format: 'pem',
|
|
257
|
+
passphrase: isString(passphrase) ? passphrase : undefined,
|
|
258
|
+
encoding: 'utf8'
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
// 验证密钥类型为 RSA
|
|
262
|
+
if (keyObject.asymmetricKeyType !== 'rsa') {
|
|
263
|
+
throw new Error('仅支持 RSA 私钥类型');
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// 强制转换为 PKCS#1 格式
|
|
267
|
+
const exported = keyObject.export({
|
|
268
|
+
type: 'pkcs1', // 明确指定 RSA 传统格式
|
|
269
|
+
format: 'pem' // 输出为 PEM 格式
|
|
270
|
+
}) as string;
|
|
271
|
+
|
|
272
|
+
return isOutputString ? String(exported) : Buffer.from(exported, 'utf8');
|
|
273
|
+
} catch (error) {
|
|
274
|
+
throw new Error(`私钥读取失败: ${error.message}`);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
|
|
209
279
|
/**
|
|
210
|
-
* @desc Inline syntax sugar
|
|
211
|
-
*/
|
|
280
|
+
* @desc Inline syntax sugar
|
|
281
|
+
*/
|
|
212
282
|
function convertToString(input, isOutputString) {
|
|
213
283
|
return Boolean(isOutputString) ? String(input) : input;
|
|
214
284
|
}
|
|
285
|
+
|
|
215
286
|
/**
|
|
216
287
|
* @desc Check if the input is an array with non-zero size
|
|
217
288
|
*/
|
|
218
|
-
export function isNonEmptyArray(a:any) {
|
|
289
|
+
export function isNonEmptyArray(a: any) {
|
|
219
290
|
return Array.isArray(a) && a.length > 0;
|
|
220
291
|
}
|
|
221
292
|
|
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import IdentityProvider, { IdentityProvider as IdentityProviderInstance } from './src/entity-idp.js';
|
|
2
|
-
import ServiceProvider, { ServiceProvider as ServiceProviderInstance } from './src/entity-sp.js';
|
|
3
|
-
export { default as IdPMetadata } from './src/metadata-idp.js';
|
|
4
|
-
export { default as SPMetadata } from './src/metadata-sp.js';
|
|
5
|
-
export { default as Utility } from './src/utility.js';
|
|
6
|
-
export { default as SamlLib } from './src/libsaml.js';
|
|
7
|
-
import * as Constants from './src/urn.js';
|
|
8
|
-
import * as Extractor from './src/extractor.js';
|
|
9
|
-
import { setSchemaValidator, setDOMParserOptions } from './src/api.js';
|
|
10
|
-
export { Constants, Extractor, IdentityProvider, IdentityProviderInstance, ServiceProvider, ServiceProviderInstance, setSchemaValidator, setDOMParserOptions };
|
|
1
|
+
import IdentityProvider, { IdentityProvider as IdentityProviderInstance } from './src/entity-idp.js';
|
|
2
|
+
import ServiceProvider, { ServiceProvider as ServiceProviderInstance } from './src/entity-sp.js';
|
|
3
|
+
export { default as IdPMetadata } from './src/metadata-idp.js';
|
|
4
|
+
export { default as SPMetadata } from './src/metadata-sp.js';
|
|
5
|
+
export { default as Utility } from './src/utility.js';
|
|
6
|
+
export { default as SamlLib } from './src/libsaml.js';
|
|
7
|
+
import * as Constants from './src/urn.js';
|
|
8
|
+
import * as Extractor from './src/extractor.js';
|
|
9
|
+
import { setSchemaValidator, setDOMParserOptions } from './src/api.js';
|
|
10
|
+
export { Constants, Extractor, IdentityProvider, IdentityProviderInstance, ServiceProvider, ServiceProviderInstance, setSchemaValidator, setDOMParserOptions };
|
package/types/src/api.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { DOMParser as dom, Options as DOMParserOptions } from '@xmldom/xmldom';
|
|
2
|
-
interface Context extends ValidatorContext, DOMParserContext {
|
|
3
|
-
}
|
|
4
|
-
interface ValidatorContext {
|
|
5
|
-
validate?: (xml: string) => Promise<any>;
|
|
6
|
-
}
|
|
7
|
-
interface DOMParserContext {
|
|
8
|
-
dom: dom;
|
|
9
|
-
}
|
|
10
|
-
export declare function getContext(): Context;
|
|
11
|
-
export declare function setSchemaValidator(params: ValidatorContext): void;
|
|
12
|
-
export declare function setDOMParserOptions(options?: DOMParserOptions): void;
|
|
13
|
-
export {};
|
|
1
|
+
import { DOMParser as dom, Options as DOMParserOptions } from '@xmldom/xmldom';
|
|
2
|
+
interface Context extends ValidatorContext, DOMParserContext {
|
|
3
|
+
}
|
|
4
|
+
interface ValidatorContext {
|
|
5
|
+
validate?: (xml: string) => Promise<any>;
|
|
6
|
+
}
|
|
7
|
+
interface DOMParserContext {
|
|
8
|
+
dom: dom;
|
|
9
|
+
}
|
|
10
|
+
export declare function getContext(): Context;
|
|
11
|
+
export declare function setSchemaValidator(params: ValidatorContext): void;
|
|
12
|
+
export declare function setDOMParserOptions(options?: DOMParserOptions): void;
|
|
13
|
+
export {};
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file binding-post.ts
|
|
3
|
-
* @author tngan
|
|
4
|
-
* @desc Binding-level API, declare the functions using POST binding
|
|
5
|
-
*/
|
|
6
|
-
import { BindingContext } from './entity.js';
|
|
7
|
-
/**
|
|
8
|
-
* @desc Generate a base64 encoded login request
|
|
9
|
-
* @param {string} referenceTagXPath reference uri
|
|
10
|
-
* @param {object} entity object includes both idp and sp
|
|
11
|
-
* @param {function} customTagReplacement used when developers have their own login response template
|
|
12
|
-
*/
|
|
13
|
-
declare function base64LoginRequest(referenceTagXPath: string, entity: any, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
14
|
-
/**
|
|
15
|
-
* @desc Generate a base64 encoded login response
|
|
16
|
-
* @param {object} requestInfo corresponding request, used to obtain the id
|
|
17
|
-
* @param {object} entity object includes both idp and sp
|
|
18
|
-
* @param {object} user current logged user (e.g. req.user)
|
|
19
|
-
* @param {function} customTagReplacement used when developers have their own login response template
|
|
20
|
-
* @param {boolean} encryptThenSign whether or not to encrypt then sign first (if signing). Defaults to sign-then-encrypt
|
|
21
|
-
*/
|
|
22
|
-
declare function base64LoginResponse(requestInfo: any
|
|
23
|
-
/**
|
|
24
|
-
* @desc Generate a base64 encoded logout request
|
|
25
|
-
* @param {object} user current logged user (e.g. req.user)
|
|
26
|
-
* @param {string} referenceTagXPath reference uri
|
|
27
|
-
* @param {object} entity object includes both idp and sp
|
|
28
|
-
* @param {function} customTagReplacement used when developers have their own login response template
|
|
29
|
-
* @return {string} base64 encoded request
|
|
30
|
-
*/
|
|
31
|
-
declare function base64LogoutRequest(user: any, referenceTagXPath: any, entity: any, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
32
|
-
/**
|
|
33
|
-
* @desc Generate a base64 encoded logout response
|
|
34
|
-
* @param {object} requestInfo corresponding request, used to obtain the id
|
|
35
|
-
* @param {string} referenceTagXPath reference uri
|
|
36
|
-
* @param {object} entity object includes both idp and sp
|
|
37
|
-
* @param {function} customTagReplacement used when developers have their own login response template
|
|
38
|
-
*/
|
|
39
|
-
declare function base64LogoutResponse(requestInfo: any, entity: any, customTagReplacement: (template: string) => BindingContext): BindingContext;
|
|
40
|
-
declare const postBinding: {
|
|
41
|
-
base64LoginRequest: typeof base64LoginRequest;
|
|
42
|
-
base64LoginResponse: typeof base64LoginResponse;
|
|
43
|
-
base64LogoutRequest: typeof base64LogoutRequest;
|
|
44
|
-
base64LogoutResponse: typeof base64LogoutResponse;
|
|
45
|
-
};
|
|
46
|
-
export default postBinding;
|
|
1
|
+
/**
|
|
2
|
+
* @file binding-post.ts
|
|
3
|
+
* @author tngan
|
|
4
|
+
* @desc Binding-level API, declare the functions using POST binding
|
|
5
|
+
*/
|
|
6
|
+
import { BindingContext } from './entity.js';
|
|
7
|
+
/**
|
|
8
|
+
* @desc Generate a base64 encoded login request
|
|
9
|
+
* @param {string} referenceTagXPath reference uri
|
|
10
|
+
* @param {object} entity object includes both idp and sp
|
|
11
|
+
* @param {function} customTagReplacement used when developers have their own login response template
|
|
12
|
+
*/
|
|
13
|
+
declare function base64LoginRequest(referenceTagXPath: string, entity: any, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
14
|
+
/**
|
|
15
|
+
* @desc Generate a base64 encoded login response
|
|
16
|
+
* @param {object} requestInfo corresponding request, used to obtain the id
|
|
17
|
+
* @param {object} entity object includes both idp and sp
|
|
18
|
+
* @param {object} user current logged user (e.g. req.user)
|
|
19
|
+
* @param {function} customTagReplacement used when developers have their own login response template
|
|
20
|
+
* @param {boolean} encryptThenSign whether or not to encrypt then sign first (if signing). Defaults to sign-then-encrypt
|
|
21
|
+
*/
|
|
22
|
+
declare function base64LoginResponse(requestInfo: any, entity: any, user?: any, customTagReplacement?: (template: string) => BindingContext, encryptThenSign?: boolean): Promise<BindingContext>;
|
|
23
|
+
/**
|
|
24
|
+
* @desc Generate a base64 encoded logout request
|
|
25
|
+
* @param {object} user current logged user (e.g. req.user)
|
|
26
|
+
* @param {string} referenceTagXPath reference uri
|
|
27
|
+
* @param {object} entity object includes both idp and sp
|
|
28
|
+
* @param {function} customTagReplacement used when developers have their own login response template
|
|
29
|
+
* @return {string} base64 encoded request
|
|
30
|
+
*/
|
|
31
|
+
declare function base64LogoutRequest(user: any, referenceTagXPath: any, entity: any, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
32
|
+
/**
|
|
33
|
+
* @desc Generate a base64 encoded logout response
|
|
34
|
+
* @param {object} requestInfo corresponding request, used to obtain the id
|
|
35
|
+
* @param {string} referenceTagXPath reference uri
|
|
36
|
+
* @param {object} entity object includes both idp and sp
|
|
37
|
+
* @param {function} customTagReplacement used when developers have their own login response template
|
|
38
|
+
*/
|
|
39
|
+
declare function base64LogoutResponse(requestInfo: any, entity: any, customTagReplacement: (template: string) => BindingContext): BindingContext;
|
|
40
|
+
declare const postBinding: {
|
|
41
|
+
base64LoginRequest: typeof base64LoginRequest;
|
|
42
|
+
base64LoginResponse: typeof base64LoginResponse;
|
|
43
|
+
base64LogoutRequest: typeof base64LogoutRequest;
|
|
44
|
+
base64LogoutResponse: typeof base64LogoutResponse;
|
|
45
|
+
};
|
|
46
|
+
export default postBinding;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { BindingContext } from './entity.js';
|
|
2
|
-
import { IdentityProvider as Idp } from './entity-idp.js';
|
|
3
|
-
import { ServiceProvider as Sp } from './entity-sp.js';
|
|
4
|
-
export interface BuildRedirectConfig {
|
|
5
|
-
baseUrl: string;
|
|
6
|
-
type: string;
|
|
7
|
-
isSigned: boolean;
|
|
8
|
-
context: string;
|
|
9
|
-
entitySetting: any;
|
|
10
|
-
relayState?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @desc Redirect URL for login request
|
|
14
|
-
* @param {object} entity object includes both idp and sp
|
|
15
|
-
* @param {function} customTagReplacement used when developers have their own login response template
|
|
16
|
-
* @return {string} redirect URL
|
|
17
|
-
*/
|
|
18
|
-
declare function loginRequestRedirectURL(entity: {
|
|
19
|
-
idp: Idp;
|
|
20
|
-
sp: Sp;
|
|
21
|
-
}, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
22
|
-
/**
|
|
23
|
-
* @desc Redirect URL for login response
|
|
24
|
-
* @param {object} requestInfo corresponding request, used to obtain the id
|
|
25
|
-
* @param {object} entity object includes both idp and sp
|
|
26
|
-
* @param {object} user current logged user (e.g. req.user)
|
|
27
|
-
* @param {String} relayState the relaystate sent by sp corresponding request
|
|
28
|
-
* @param {function} customTagReplacement used when developers have their own login response template
|
|
29
|
-
*/
|
|
30
|
-
declare function loginResponseRedirectURL(requestInfo: any, entity: any, user?: any, relayState?: string, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
31
|
-
/**
|
|
32
|
-
* @desc Redirect URL for logout request
|
|
33
|
-
* @param {object} user current logged user (e.g. req.user)
|
|
34
|
-
* @param {object} entity object includes both idp and sp
|
|
35
|
-
* @param {function} customTagReplacement used when developers have their own login response template
|
|
36
|
-
* @return {string} redirect URL
|
|
37
|
-
*/
|
|
38
|
-
declare function logoutRequestRedirectURL(user: any, entity: any, relayState?: string, customTagReplacement?: (template: string, tags: object) => BindingContext): BindingContext;
|
|
39
|
-
/**
|
|
40
|
-
* @desc Redirect URL for logout response
|
|
41
|
-
* @param {object} requescorresponding request, used to obtain the id
|
|
42
|
-
* @param {object} entity object includes both idp and sp
|
|
43
|
-
* @param {function} customTagReplacement used when developers have their own login response template
|
|
44
|
-
*/
|
|
45
|
-
declare function logoutResponseRedirectURL(requestInfo: any, entity: any, relayState?: string, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
46
|
-
declare const redirectBinding: {
|
|
47
|
-
loginRequestRedirectURL: typeof loginRequestRedirectURL;
|
|
48
|
-
loginResponseRedirectURL: typeof loginResponseRedirectURL;
|
|
49
|
-
logoutRequestRedirectURL: typeof logoutRequestRedirectURL;
|
|
50
|
-
logoutResponseRedirectURL: typeof logoutResponseRedirectURL;
|
|
51
|
-
};
|
|
52
|
-
export default redirectBinding;
|
|
1
|
+
import { BindingContext } from './entity.js';
|
|
2
|
+
import { IdentityProvider as Idp } from './entity-idp.js';
|
|
3
|
+
import { ServiceProvider as Sp } from './entity-sp.js';
|
|
4
|
+
export interface BuildRedirectConfig {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
type: string;
|
|
7
|
+
isSigned: boolean;
|
|
8
|
+
context: string;
|
|
9
|
+
entitySetting: any;
|
|
10
|
+
relayState?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @desc Redirect URL for login request
|
|
14
|
+
* @param {object} entity object includes both idp and sp
|
|
15
|
+
* @param {function} customTagReplacement used when developers have their own login response template
|
|
16
|
+
* @return {string} redirect URL
|
|
17
|
+
*/
|
|
18
|
+
declare function loginRequestRedirectURL(entity: {
|
|
19
|
+
idp: Idp;
|
|
20
|
+
sp: Sp;
|
|
21
|
+
}, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
22
|
+
/**
|
|
23
|
+
* @desc Redirect URL for login response
|
|
24
|
+
* @param {object} requestInfo corresponding request, used to obtain the id
|
|
25
|
+
* @param {object} entity object includes both idp and sp
|
|
26
|
+
* @param {object} user current logged user (e.g. req.user)
|
|
27
|
+
* @param {String} relayState the relaystate sent by sp corresponding request
|
|
28
|
+
* @param {function} customTagReplacement used when developers have their own login response template
|
|
29
|
+
*/
|
|
30
|
+
declare function loginResponseRedirectURL(requestInfo: any, entity: any, user?: any, relayState?: string, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
31
|
+
/**
|
|
32
|
+
* @desc Redirect URL for logout request
|
|
33
|
+
* @param {object} user current logged user (e.g. req.user)
|
|
34
|
+
* @param {object} entity object includes both idp and sp
|
|
35
|
+
* @param {function} customTagReplacement used when developers have their own login response template
|
|
36
|
+
* @return {string} redirect URL
|
|
37
|
+
*/
|
|
38
|
+
declare function logoutRequestRedirectURL(user: any, entity: any, relayState?: string, customTagReplacement?: (template: string, tags: object) => BindingContext): BindingContext;
|
|
39
|
+
/**
|
|
40
|
+
* @desc Redirect URL for logout response
|
|
41
|
+
* @param {object} requescorresponding request, used to obtain the id
|
|
42
|
+
* @param {object} entity object includes both idp and sp
|
|
43
|
+
* @param {function} customTagReplacement used when developers have their own login response template
|
|
44
|
+
*/
|
|
45
|
+
declare function logoutResponseRedirectURL(requestInfo: any, entity: any, relayState?: string, customTagReplacement?: (template: string) => BindingContext): BindingContext;
|
|
46
|
+
declare const redirectBinding: {
|
|
47
|
+
loginRequestRedirectURL: typeof loginRequestRedirectURL;
|
|
48
|
+
loginResponseRedirectURL: typeof loginResponseRedirectURL;
|
|
49
|
+
logoutRequestRedirectURL: typeof logoutRequestRedirectURL;
|
|
50
|
+
logoutResponseRedirectURL: typeof logoutResponseRedirectURL;
|
|
51
|
+
};
|
|
52
|
+
export default redirectBinding;
|