@adobe/acc-js-sdk 1.1.18 → 1.1.19

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.
@@ -2,13 +2,19 @@
2
2
  layout: page
3
3
  title: Change Log
4
4
  ---
5
+
6
+ <section class="changelog"><h1>Version 1.1.19</h1>
7
+ <h2>2022/12/21</h2>
8
+
9
+ <li>Add the X-Session-Token custom header to all SOAP and API calls</li>
10
+ </section>
11
+
5
12
  <section class="changelog"><h1>Version 1.1.18</h1>
6
13
  <h2>2022/12/20</h2>
7
14
 
8
15
  <li>Automatically remove from local storage key items which correspond to previous versions of the SDK.</li>
9
16
  </section>
10
17
 
11
-
12
18
  <section class="changelog"><h1>Version 1.1.17</h1>
13
19
  <h2>2022/12/06</h2>
14
20
 
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/acc-js-sdk",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/acc-js-sdk",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "description": "ACC Javascript SDK",
5
5
  "main": "src/index.js",
6
6
  "homepage": "https://github.com/adobe/acc-js-sdk#readme",
package/src/client.js CHANGED
@@ -1881,6 +1881,7 @@ class Client {
1881
1881
  url: `${this._connectionParameters._endpoint}/nl/jsp/ping.jsp`,
1882
1882
  headers: {
1883
1883
  'X-Security-Token': this._securityToken,
1884
+ 'X-Session-Token': this._sessionToken,
1884
1885
  'Cookie': '__sessiontoken=' + this._sessionToken
1885
1886
  }
1886
1887
  };
@@ -1951,6 +1952,7 @@ class Client {
1951
1952
  url: `${this._connectionParameters._endpoint}/nl/jsp/mcPing.jsp`,
1952
1953
  headers: {
1953
1954
  'X-Security-Token': this._securityToken,
1955
+ 'X-Session-Token': this._sessionToken,
1954
1956
  'Cookie': '__sessiontoken=' + this._sessionToken
1955
1957
  }
1956
1958
  };
package/src/soap.js CHANGED
@@ -538,7 +538,8 @@ class SoapMethodCall {
538
538
  const headers = {
539
539
  'Content-type': `application/soap+xml${this._charset ? ";charset=" + this._charset : ""}`,
540
540
  'SoapAction': `${this.urn}#${this.methodName}`,
541
- 'X-Security-Token': this._securityToken
541
+ 'X-Security-Token': this._securityToken,
542
+ 'X-Session-Token': this._sessionToken,
542
543
  };
543
544
 
544
545
  // Add HTTP headers specific to the SOAP call for better tracing/troubleshooting
package/src/util.js CHANGED
@@ -98,7 +98,8 @@ class Util {
98
98
  }
99
99
  if (typeof obj == "object") {
100
100
  for (const p in obj) {
101
- if (p.toLowerCase() === "x-security-token")
101
+ const lowerP = p.toLowerCase();
102
+ if (lowerP === "x-security-token" || lowerP === "x-session-token")
102
103
  obj[p] = "***";
103
104
  else if (p === "Cookie") {
104
105
  var index = obj[p].toLowerCase().indexOf("__sessiontoken");
@@ -126,6 +127,7 @@ class Util {
126
127
  // Hide session tokens
127
128
  obj = this._removeBetween(obj, "<Cookie>__sessiontoken=", "</Cookie>");
128
129
  obj = this._removeBetween(obj, "<X-Security-Token>", "</X-Security-Token>");
130
+ obj = this._removeBetween(obj, "<X-Session-Token>", "</X-Session-Token>");
129
131
  obj = this._removeBetween(obj, '<sessiontoken xsi:type="xsd:string">', '</sessiontoken>');
130
132
  obj = this._removeBetween(obj, "<pstrSessionToken xsi:type='xsd:string'>", "</pstrSessionToken>");
131
133
  obj = this._removeBetween(obj, "<pstrSecurityToken xsi:type='xsd:string'>", "</pstrSecurityToken>");
package/test/soap.test.js CHANGED
@@ -163,6 +163,7 @@ describe('SOAP', function() {
163
163
  const call = makeSoapMethodCall(undefined, "xtk:session", "Empty", "$session$", "$security$");
164
164
  const [ request ] = call._createHTTPRequest(URL);
165
165
  assert.equal(request.headers["X-Security-Token"], "$security$", "Security token matches");
166
+ assert.equal(request.headers["X-Session-Token"], "$session$", "Session token matches");
166
167
  assert.equal(request.headers["Cookie"], "__sessiontoken=$session$", "Session token matches");
167
168
  const env = DomUtil.parse(request.data).documentElement;
168
169
  const header = hasChildElement(env, "SOAP-ENV:Header");
package/test/util.test.js CHANGED
@@ -86,6 +86,10 @@ describe('Util', function() {
86
86
  expect(Util.trim({hello:"Lead<X-Security-Token>Stuff</X-Security-Token>Trail"})).toStrictEqual({hello:"Lead<X-Security-Token>***</X-Security-Token>Trail"});
87
87
  })
88
88
 
89
+ it("Should remove session token headers", () => {
90
+ expect(Util.trim({hello:"Lead<X-Session-Token>Stuff</X-Session-Token>Trail"})).toStrictEqual({hello:"Lead<X-Session-Token>***</X-Session-Token>Trail"});
91
+ })
92
+
89
93
  it("Should remove session tokens", () => {
90
94
  expect(Util.trim({hello:'Lead<sessiontoken xsi:type="xsd:string">Stuff</sessiontoken>Trail'})).toStrictEqual({hello:'Lead<sessiontoken xsi:type="xsd:string">***</sessiontoken>Trail'});
91
95
  })