saml 2.0.0 → 2.0.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [2.0.1](https://github.com/auth0/node-saml/compare/v2.0.0...v2.0.1) (2022-02-09)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **saml11:** do not mutate moment() when options.lifetimeInSeconds is provided ([0a5afd1](https://github.com/auth0/node-saml/commit/0a5afd1977dc832f1cc51de6af7c801cc95f78b5))
11
+
5
12
  ## [2.0.0](https://github.com/auth0/node-saml/compare/v1.0.1...v2.0.0) (2022-02-04)
6
13
 
7
14
 
package/lib/saml11.js CHANGED
@@ -118,7 +118,7 @@ function createAssertion(options, strategies, callback) {
118
118
 
119
119
  if (options.lifetimeInSeconds) {
120
120
  conditions[0].setAttribute('NotBefore', now.format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
121
- conditions[0].setAttribute('NotOnOrAfter', now.add(options.lifetimeInSeconds, 'seconds').format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
121
+ conditions[0].setAttribute('NotOnOrAfter', moment(now).add(options.lifetimeInSeconds, 'seconds').format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
122
122
  }
123
123
 
124
124
  if (options.audiences) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saml",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "engines": {
5
5
  "node": ">=12"
6
6
  },
@@ -95,10 +95,13 @@ describe('saml 1.1', function () {
95
95
  var signedAssertion = saml11[createAssertion](options);
96
96
  var conditions = utils.getConditions(signedAssertion);
97
97
  assert.equal(1, conditions.length);
98
+ var authenticationInstant = utils.getAuthenticationInstant(signedAssertion);
98
99
  var notBefore = conditions[0].getAttribute('NotBefore');
99
100
  var notOnOrAfter = conditions[0].getAttribute('NotOnOrAfter');
101
+
100
102
  should.ok(notBefore);
101
103
  should.ok(notOnOrAfter);
104
+ should.equal(authenticationInstant, notBefore);
102
105
 
103
106
  var lifetime = Math.round((moment(notOnOrAfter).utc() - moment(notBefore).utc()) / 1000);
104
107
  assert.equal(600, lifetime);
package/test/utils.js CHANGED
@@ -47,6 +47,10 @@ exports.getIssueInstant = function(assertion) {
47
47
  return doc.documentElement.getAttribute('IssueInstant');
48
48
  };
49
49
 
50
+ exports.getAuthenticationInstant = function (assertion) {
51
+ return exports.getAuthenticationStatement(assertion).getAttribute('AuthenticationInstant');
52
+ };
53
+
50
54
  exports.getConditions = function(assertion) {
51
55
  var doc = new xmldom.DOMParser().parseFromString(assertion);
52
56
  return doc.documentElement.getElementsByTagName('saml:Conditions');