From 3ac131590a0312627ca41f00557f15cfa9ff38f1 Mon Sep 17 00:00:00 2001 From: Seth Wheeler Date: Tue, 2 Feb 2021 13:52:17 -0800 Subject: [PATCH] Include _cas_retry in url --- lib/passport-cas.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/passport-cas.js b/lib/passport-cas.js index 52f1c33..540c34d 100644 --- a/lib/passport-cas.js +++ b/lib/passport-cas.js @@ -168,7 +168,8 @@ CasStrategy.prototype.authenticate = function(req, options) { if (!ticket) { // Redirect to CAS server for authentication - self.redirect(self.casBaseUrl + '/login?service=' + encodeURIComponent(service), 307); + var date = new Date(Date.now()); + self.redirect(`${self.casBaseUrl}/login?service=${encodeURIComponent(`${service}/?_cas_retry=${Math.round(date.getTime() / 60000)}`)}`, 307); } else { // User has returned from CAS site with a ticket @@ -176,7 +177,7 @@ CasStrategy.prototype.authenticate = function(req, options) { // Ticket validation failed if (err) { - var date = new Date(); + var date = new Date(Date.now()); var token = Math.round(date.getTime() / 60000); if (req.query['_cas_retry'] != token) { // There was a CAS error. A common cause is when an old