Skip to content

Commit

Permalink
Include _cas_retry in url
Browse files Browse the repository at this point in the history
  • Loading branch information
Megapixel99 committed Feb 2, 2021
1 parent 63b6d0b commit 3ac1315
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/passport-cas.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,16 @@ 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
self.cas.validate(ticket, function(err, status, username, extended) {

// 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
Expand Down

0 comments on commit 3ac1315

Please sign in to comment.