samlesa 2.12.3

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.
Files changed (99) hide show
  1. package/.editorconfig +19 -0
  2. package/.github/FUNDING.yml +1 -0
  3. package/.idea/compiler.xml +6 -0
  4. package/.idea/deployment.xml +14 -0
  5. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  6. package/.idea/jsLibraryMappings.xml +6 -0
  7. package/.idea/modules.xml +8 -0
  8. package/.idea/samlify.iml +12 -0
  9. package/.idea/vcs.xml +6 -0
  10. package/.pre-commit.sh +15 -0
  11. package/.snyk +8 -0
  12. package/.travis.yml +29 -0
  13. package/LICENSE +22 -0
  14. package/Makefile +25 -0
  15. package/README.md +84 -0
  16. package/build/.idea/workspace.xml +58 -0
  17. package/build/index.js +65 -0
  18. package/build/index.js.map +1 -0
  19. package/build/src/api.js +24 -0
  20. package/build/src/api.js.map +1 -0
  21. package/build/src/binding-post.js +369 -0
  22. package/build/src/binding-post.js.map +1 -0
  23. package/build/src/binding-redirect.js +333 -0
  24. package/build/src/binding-redirect.js.map +1 -0
  25. package/build/src/binding-simplesign.js +233 -0
  26. package/build/src/binding-simplesign.js.map +1 -0
  27. package/build/src/entity-idp.js +131 -0
  28. package/build/src/entity-idp.js.map +1 -0
  29. package/build/src/entity-sp.js +97 -0
  30. package/build/src/entity-sp.js.map +1 -0
  31. package/build/src/entity.js +236 -0
  32. package/build/src/entity.js.map +1 -0
  33. package/build/src/extractor.js +370 -0
  34. package/build/src/extractor.js.map +1 -0
  35. package/build/src/flow.js +320 -0
  36. package/build/src/flow.js.map +1 -0
  37. package/build/src/libsaml.js +642 -0
  38. package/build/src/libsaml.js.map +1 -0
  39. package/build/src/metadata-idp.js +128 -0
  40. package/build/src/metadata-idp.js.map +1 -0
  41. package/build/src/metadata-sp.js +232 -0
  42. package/build/src/metadata-sp.js.map +1 -0
  43. package/build/src/metadata.js +177 -0
  44. package/build/src/metadata.js.map +1 -0
  45. package/build/src/types.js +12 -0
  46. package/build/src/types.js.map +1 -0
  47. package/build/src/urn.js +213 -0
  48. package/build/src/urn.js.map +1 -0
  49. package/build/src/utility.js +249 -0
  50. package/build/src/utility.js.map +1 -0
  51. package/build/src/validator.js +27 -0
  52. package/build/src/validator.js.map +1 -0
  53. package/index.d.ts +10 -0
  54. package/index.js +19 -0
  55. package/index.js.map +1 -0
  56. package/index.ts +28 -0
  57. package/package.json +74 -0
  58. package/qodana.yaml +29 -0
  59. package/src/.idea/modules.xml +8 -0
  60. package/src/.idea/src.iml +12 -0
  61. package/src/.idea/vcs.xml +6 -0
  62. package/src/api.ts +36 -0
  63. package/src/binding-post.ts +338 -0
  64. package/src/binding-redirect.ts +331 -0
  65. package/src/binding-simplesign.ts +231 -0
  66. package/src/entity-idp.ts +145 -0
  67. package/src/entity-sp.ts +114 -0
  68. package/src/entity.ts +243 -0
  69. package/src/extractor.ts +392 -0
  70. package/src/flow.ts +467 -0
  71. package/src/libsaml.ts +786 -0
  72. package/src/metadata-idp.ts +146 -0
  73. package/src/metadata-sp.ts +268 -0
  74. package/src/metadata.ts +166 -0
  75. package/src/types.ts +153 -0
  76. package/src/urn.ts +211 -0
  77. package/src/utility.ts +248 -0
  78. package/src/validator.ts +44 -0
  79. package/tsconfig.json +38 -0
  80. package/tslint.json +35 -0
  81. package/types/index.d.ts +10 -0
  82. package/types/src/api.d.ts +13 -0
  83. package/types/src/binding-post.d.ts +46 -0
  84. package/types/src/binding-redirect.d.ts +52 -0
  85. package/types/src/binding-simplesign.d.ts +39 -0
  86. package/types/src/entity-idp.d.ts +42 -0
  87. package/types/src/entity-sp.d.ts +36 -0
  88. package/types/src/entity.d.ts +99 -0
  89. package/types/src/extractor.d.ts +25 -0
  90. package/types/src/flow.d.ts +6 -0
  91. package/types/src/libsaml.d.ts +210 -0
  92. package/types/src/metadata-idp.d.ts +24 -0
  93. package/types/src/metadata-sp.d.ts +36 -0
  94. package/types/src/metadata.d.ts +57 -0
  95. package/types/src/types.d.ts +127 -0
  96. package/types/src/urn.d.ts +194 -0
  97. package/types/src/utility.d.ts +134 -0
  98. package/types/src/validator.d.ts +3 -0
  99. package/types.d.ts +2 -0
package/qodana.yaml ADDED
@@ -0,0 +1,29 @@
1
+ #-------------------------------------------------------------------------------#
2
+ # Qodana analysis is configured by qodana.yaml file #
3
+ # https://www.jetbrains.com/help/qodana/qodana-yaml.html #
4
+ #-------------------------------------------------------------------------------#
5
+ version: "1.0"
6
+
7
+ #Specify inspection profile for code analysis
8
+ profile:
9
+ name: qodana.starter
10
+
11
+ #Enable inspections
12
+ #include:
13
+ # - name: <SomeEnabledInspectionId>
14
+
15
+ #Disable inspections
16
+ #exclude:
17
+ # - name: <SomeDisabledInspectionId>
18
+ # paths:
19
+ # - <path/where/not/run/inspection>
20
+
21
+ #Execute shell command before Qodana execution (Applied in CI/CD pipeline)
22
+ #bootstrap: sh ./prepare-qodana.sh
23
+
24
+ #Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
25
+ #plugins:
26
+ # - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
27
+
28
+ #Specify Qodana linter for analysis (Applied in CI/CD pipeline)
29
+ linter: jetbrains/qodana-js:2025.1
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/src.iml" filepath="$PROJECT_DIR$/.idea/src.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
+ </component>
6
+ </project>
package/src/api.ts ADDED
@@ -0,0 +1,36 @@
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
+ }
@@ -0,0 +1,338 @@
1
+ /**
2
+ * @file binding-post.ts
3
+ * @author tngan
4
+ * @desc Binding-level API, declare the functions using POST binding
5
+ */
6
+
7
+ import { wording, namespace, StatusCode } from './urn.js';
8
+ import { BindingContext } from './entity.js';
9
+ import libsaml from './libsaml.js';
10
+ import utility, { get } from './utility.js';
11
+
12
+ const binding = wording.binding;
13
+
14
+ /**
15
+ * @desc Generate a base64 encoded login request
16
+ * @param {string} referenceTagXPath reference uri
17
+ * @param {object} entity object includes both idp and sp
18
+ * @param {function} customTagReplacement used when developers have their own login response template
19
+ */
20
+ function base64LoginRequest(referenceTagXPath: string, entity: any, customTagReplacement?: (template: string) => BindingContext): BindingContext {
21
+ const metadata = { idp: entity.idp.entityMeta, sp: entity.sp.entityMeta };
22
+ const spSetting = entity.sp.entitySetting;
23
+ let id: string = '';
24
+
25
+ if (metadata && metadata.idp && metadata.sp) {
26
+ const base = metadata.idp.getSingleSignOnService(binding.post);
27
+ let rawSamlRequest: string;
28
+ if (spSetting.loginRequestTemplate && customTagReplacement) {
29
+ const info = customTagReplacement(spSetting.loginRequestTemplate.context);
30
+ id = get(info, 'id', null);
31
+ rawSamlRequest = get(info, 'context', null);
32
+ } else {
33
+ const nameIDFormat = spSetting.nameIDFormat;
34
+ const selectedNameIDFormat = Array.isArray(nameIDFormat) ? nameIDFormat[0] : nameIDFormat;
35
+ id = spSetting.generateID();
36
+ rawSamlRequest = libsaml.replaceTagsByValue(libsaml.defaultLoginRequestTemplate.context, {
37
+ ID: id,
38
+ Destination: base,
39
+ Issuer: metadata.sp.getEntityID(),
40
+ IssueInstant: new Date().toISOString(),
41
+ AssertionConsumerServiceURL: metadata.sp.getAssertionConsumerService(binding.post),
42
+ EntityID: metadata.sp.getEntityID(),
43
+ AllowCreate: spSetting.allowCreate,
44
+ NameIDFormat: selectedNameIDFormat
45
+ } as any);
46
+ }
47
+ if (metadata.idp.isWantAuthnRequestsSigned()) {
48
+ const { privateKey, privateKeyPass, requestSignatureAlgorithm: signatureAlgorithm, transformationAlgorithms } = spSetting;
49
+ return {
50
+ id,
51
+ context: libsaml.constructSAMLSignature({
52
+ referenceTagXPath,
53
+ privateKey,
54
+ privateKeyPass,
55
+ signatureAlgorithm,
56
+ transformationAlgorithms,
57
+ rawSamlMessage: rawSamlRequest,
58
+ signingCert: metadata.sp.getX509Certificate('signing'),
59
+ signatureConfig: spSetting.signatureConfig || {
60
+ prefix: 'ds',
61
+ location: { reference: "/*[local-name(.)='AuthnRequest']/*[local-name(.)='Issuer']", action: 'after' },
62
+ }
63
+ }),
64
+ };
65
+ }
66
+ // No need to embeded XML signature
67
+ return {
68
+ id,
69
+ context: utility.base64Encode(rawSamlRequest),
70
+ };
71
+ }
72
+ throw new Error('ERR_GENERATE_POST_LOGIN_REQUEST_MISSING_METADATA');
73
+ }
74
+ /**
75
+ * @desc Generate a base64 encoded login response
76
+ * @param {object} requestInfo corresponding request, used to obtain the id
77
+ * @param {object} entity object includes both idp and sp
78
+ * @param {object} user current logged user (e.g. req.user)
79
+ * @param {function} customTagReplacement used when developers have their own login response template
80
+ * @param {boolean} encryptThenSign whether or not to encrypt then sign first (if signing). Defaults to sign-then-encrypt
81
+ */
82
+ async function base64LoginResponse(requestInfo: any = {}, entity: any, user: any = {}, customTagReplacement?: (template: string) => BindingContext, encryptThenSign: boolean = false): Promise<BindingContext> {
83
+ const idpSetting = entity.idp.entitySetting;
84
+ const spSetting = entity.sp.entitySetting;
85
+ const id = idpSetting.generateID();
86
+ const metadata = {
87
+ idp: entity.idp.entityMeta,
88
+ sp: entity.sp.entityMeta,
89
+ };
90
+ const nameIDFormat = idpSetting.nameIDFormat;
91
+ const selectedNameIDFormat = Array.isArray(nameIDFormat) ? nameIDFormat[0] : nameIDFormat;
92
+ if (metadata && metadata.idp && metadata.sp) {
93
+ const base = metadata.sp.getAssertionConsumerService(binding.post);
94
+ let rawSamlResponse: string;
95
+ const nowTime = new Date();
96
+ const spEntityID = metadata.sp.getEntityID();
97
+ const fiveMinutesLaterTime = new Date(nowTime.getTime());
98
+ fiveMinutesLaterTime.setMinutes(fiveMinutesLaterTime.getMinutes() + 5);
99
+ const fiveMinutesLater = fiveMinutesLaterTime.toISOString();
100
+ const now = nowTime.toISOString();
101
+ const acl = metadata.sp.getAssertionConsumerService(binding.post);
102
+ const tvalue: any = {
103
+ ID: id,
104
+ AssertionID: idpSetting.generateID(),
105
+ Destination: base,
106
+ Audience: spEntityID,
107
+ EntityID: spEntityID,
108
+ SubjectRecipient: acl,
109
+ Issuer: metadata.idp.getEntityID(),
110
+ IssueInstant: now,
111
+ AssertionConsumerServiceURL: acl,
112
+ StatusCode: StatusCode.Success,
113
+ // can be customized
114
+ ConditionsNotBefore: now,
115
+ ConditionsNotOnOrAfter: fiveMinutesLater,
116
+ SubjectConfirmationDataNotOnOrAfter: fiveMinutesLater,
117
+ NameIDFormat: selectedNameIDFormat,
118
+ NameID: user.email || '',
119
+ InResponseTo: get(requestInfo, 'extract.request.id', ''),
120
+ AuthnStatement: '',
121
+ AttributeStatement: '',
122
+ };
123
+ if (idpSetting.loginResponseTemplate && customTagReplacement) {
124
+ const template = customTagReplacement(idpSetting.loginResponseTemplate.context);
125
+ rawSamlResponse = get(template, 'context', null);
126
+ } else {
127
+ if (requestInfo !== null) {
128
+ tvalue.InResponseTo = requestInfo.extract.request.id;
129
+ }
130
+ rawSamlResponse = libsaml.replaceTagsByValue(libsaml.defaultLoginResponseTemplate.context, tvalue);
131
+ }
132
+ const { privateKey, privateKeyPass, requestSignatureAlgorithm: signatureAlgorithm } = idpSetting;
133
+ const config = {
134
+ privateKey,
135
+ privateKeyPass,
136
+ signatureAlgorithm,
137
+ signingCert: metadata.idp.getX509Certificate('signing'),
138
+ isBase64Output: false,
139
+ };
140
+ // step: sign assertion ? -> encrypted ? -> sign message ?
141
+ if (metadata.sp.isWantAssertionsSigned()) {
142
+ // console.debug('sp wants assertion signed');
143
+ rawSamlResponse = libsaml.constructSAMLSignature({
144
+ ...config,
145
+ rawSamlMessage: rawSamlResponse,
146
+ transformationAlgorithms: spSetting.transformationAlgorithms,
147
+ referenceTagXPath: "/*[local-name(.)='Response']/*[local-name(.)='Assertion']",
148
+ signatureConfig: {
149
+ prefix: 'ds',
150
+ location: { reference: "/*[local-name(.)='Response']/*[local-name(.)='Assertion']/*[local-name(.)='Issuer']", action: 'after' },
151
+ },
152
+ });
153
+ }
154
+
155
+ // console.debug('after assertion signed', rawSamlResponse);
156
+
157
+ // SAML response must be signed sign message first, then encrypt
158
+ if (!encryptThenSign && (spSetting.wantMessageSigned || !metadata.sp.isWantAssertionsSigned())) {
159
+ // console.debug('sign then encrypt and sign entire message');
160
+ rawSamlResponse = libsaml.constructSAMLSignature({
161
+ ...config,
162
+ rawSamlMessage: rawSamlResponse,
163
+ isMessageSigned: true,
164
+ transformationAlgorithms: spSetting.transformationAlgorithms,
165
+ signatureConfig: spSetting.signatureConfig || {
166
+ prefix: 'ds',
167
+ location: { reference: "/*[local-name(.)='Response']/*[local-name(.)='Issuer']", action: 'after' },
168
+ },
169
+ });
170
+ console.log(rawSamlResponse);
171
+ console.log("这他妈是什么------------------")
172
+ }
173
+
174
+ // console.debug('after message signed', rawSamlResponse);
175
+
176
+ if (idpSetting.isAssertionEncrypted) {
177
+ // console.debug('idp is configured to do encryption');
178
+ const context = await libsaml.encryptAssertion(entity.idp, entity.sp, rawSamlResponse);
179
+ if (encryptThenSign) {
180
+ //need to decode it
181
+ rawSamlResponse = utility.base64Decode(context) as string;
182
+ } else {
183
+ return Promise.resolve({ id, context });
184
+ }
185
+ }
186
+
187
+ //sign after encrypting
188
+ if (encryptThenSign && (spSetting.wantMessageSigned || !metadata.sp.isWantAssertionsSigned())) {
189
+ rawSamlResponse = libsaml.constructSAMLSignature({
190
+ ...config,
191
+ rawSamlMessage: rawSamlResponse,
192
+ isMessageSigned: true,
193
+ transformationAlgorithms: spSetting.transformationAlgorithms,
194
+ signatureConfig: spSetting.signatureConfig || {
195
+ prefix: 'ds',
196
+ location: { reference: "/*[local-name(.)='Response']/*[local-name(.)='Issuer']", action: 'after' },
197
+ },
198
+ });
199
+ }
200
+
201
+ return Promise.resolve({
202
+ id,
203
+ context: utility.base64Encode(rawSamlResponse),
204
+ });
205
+
206
+ }
207
+ throw new Error('ERR_GENERATE_POST_LOGIN_RESPONSE_MISSING_METADATA');
208
+ }
209
+ /**
210
+ * @desc Generate a base64 encoded logout request
211
+ * @param {object} user current logged user (e.g. req.user)
212
+ * @param {string} referenceTagXPath reference uri
213
+ * @param {object} entity object includes both idp and sp
214
+ * @param {function} customTagReplacement used when developers have their own login response template
215
+ * @return {string} base64 encoded request
216
+ */
217
+ function base64LogoutRequest(user, referenceTagXPath, entity, customTagReplacement?: (template: string) => BindingContext): BindingContext {
218
+ const metadata = { init: entity.init.entityMeta, target: entity.target.entityMeta };
219
+ const initSetting = entity.init.entitySetting;
220
+ const nameIDFormat = initSetting.nameIDFormat;
221
+ const selectedNameIDFormat = Array.isArray(nameIDFormat) ? nameIDFormat[0] : nameIDFormat; let id: string = '';
222
+ if (metadata && metadata.init && metadata.target) {
223
+ let rawSamlRequest: string;
224
+ if (initSetting.logoutRequestTemplate && customTagReplacement) {
225
+ const template = customTagReplacement(initSetting.logoutRequestTemplate.context);
226
+ id = get(template, 'id', null);
227
+ rawSamlRequest = get(template, 'context', null);
228
+ } else {
229
+ id = initSetting.generateID();
230
+ const tvalue: any = {
231
+ ID: id,
232
+ Destination: metadata.target.getSingleLogoutService(binding.post),
233
+ Issuer: metadata.init.getEntityID(),
234
+ IssueInstant: new Date().toISOString(),
235
+ EntityID: metadata.init.getEntityID(),
236
+ NameIDFormat: selectedNameIDFormat,
237
+ NameID: user.logoutNameID,
238
+ };
239
+ rawSamlRequest = libsaml.replaceTagsByValue(libsaml.defaultLogoutRequestTemplate.context, tvalue);
240
+ }
241
+ if (entity.target.entitySetting.wantLogoutRequestSigned) {
242
+ // Need to embeded XML signature
243
+ const { privateKey, privateKeyPass, requestSignatureAlgorithm: signatureAlgorithm, transformationAlgorithms } = initSetting;
244
+ return {
245
+ id,
246
+ context: libsaml.constructSAMLSignature({
247
+ referenceTagXPath,
248
+ privateKey,
249
+ privateKeyPass,
250
+ signatureAlgorithm,
251
+ transformationAlgorithms,
252
+ rawSamlMessage: rawSamlRequest,
253
+ signingCert: metadata.init.getX509Certificate('signing'),
254
+ signatureConfig: initSetting.signatureConfig || {
255
+ prefix: 'ds',
256
+ location: { reference: "/*[local-name(.)='LogoutRequest']/*[local-name(.)='Issuer']", action: 'after' },
257
+ }
258
+ }),
259
+ };
260
+ }
261
+ return {
262
+ id,
263
+ context: utility.base64Encode(rawSamlRequest),
264
+ };
265
+ }
266
+ throw new Error('ERR_GENERATE_POST_LOGOUT_REQUEST_MISSING_METADATA');
267
+ }
268
+ /**
269
+ * @desc Generate a base64 encoded logout response
270
+ * @param {object} requestInfo corresponding request, used to obtain the id
271
+ * @param {string} referenceTagXPath reference uri
272
+ * @param {object} entity object includes both idp and sp
273
+ * @param {function} customTagReplacement used when developers have their own login response template
274
+ */
275
+ function base64LogoutResponse(requestInfo: any, entity: any, customTagReplacement: (template: string) => BindingContext): BindingContext {
276
+ const metadata = {
277
+ init: entity.init.entityMeta,
278
+ target: entity.target.entityMeta,
279
+ };
280
+ let id: string = '';
281
+ const initSetting = entity.init.entitySetting;
282
+ if (metadata && metadata.init && metadata.target) {
283
+ let rawSamlResponse;
284
+ if (initSetting.logoutResponseTemplate) {
285
+ const template = customTagReplacement(initSetting.logoutResponseTemplate.context);
286
+ id = template.id;
287
+ rawSamlResponse = template.context;
288
+ } else {
289
+ id = initSetting.generateID();
290
+ const tvalue: any = {
291
+ ID: id,
292
+ Destination: metadata.target.getSingleLogoutService(binding.post),
293
+ EntityID: metadata.init.getEntityID(),
294
+ Issuer: metadata.init.getEntityID(),
295
+ IssueInstant: new Date().toISOString(),
296
+ StatusCode: StatusCode.Success,
297
+ InResponseTo: get(requestInfo, 'extract.request.id', null)
298
+ };
299
+ rawSamlResponse = libsaml.replaceTagsByValue(libsaml.defaultLogoutResponseTemplate.context, tvalue);
300
+ }
301
+ if (entity.target.entitySetting.wantLogoutResponseSigned) {
302
+ const { privateKey, privateKeyPass, requestSignatureAlgorithm: signatureAlgorithm, transformationAlgorithms } = initSetting;
303
+ return {
304
+ id,
305
+ context: libsaml.constructSAMLSignature({
306
+ isMessageSigned: true,
307
+ transformationAlgorithms: transformationAlgorithms,
308
+ privateKey,
309
+ privateKeyPass,
310
+ signatureAlgorithm,
311
+ rawSamlMessage: rawSamlResponse,
312
+ signingCert: metadata.init.getX509Certificate('signing'),
313
+ signatureConfig: {
314
+ prefix: 'ds',
315
+ location: {
316
+ reference: "/*[local-name(.)='LogoutResponse']/*[local-name(.)='Issuer']",
317
+ action: 'after'
318
+ }
319
+ }
320
+ }),
321
+ };
322
+ }
323
+ return {
324
+ id,
325
+ context: utility.base64Encode(rawSamlResponse),
326
+ };
327
+ }
328
+ throw new Error('ERR_GENERATE_POST_LOGOUT_RESPONSE_MISSING_METADATA');
329
+ }
330
+
331
+ const postBinding = {
332
+ base64LoginRequest,
333
+ base64LoginResponse,
334
+ base64LogoutRequest,
335
+ base64LogoutResponse,
336
+ };
337
+
338
+ export default postBinding;