Skip to content

Commit

Permalink
Added cookieExpires for domain cookies to standardize session expirat…
Browse files Browse the repository at this point in the history
…ion (#19)
  • Loading branch information
rorylshanks authored Mar 15, 2024
1 parent 3acb003 commit 8c93acb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/sso.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ async function setSessionCookie(req, res) {

req.session.loggedin = true
req.session.userId = decoded.userId;

// This sets the cookie for the accessed domain to expire at the same time as the "main" veriflow cookie, to
// prevent a user from being deauthenticated from Veriflow, but still authenticated on the subdomains.
req.session.cookie.expires = decoded.cookieExpires

var redirectProtocol = decoded.protocol
var redirectHost = decoded.host
Expand Down Expand Up @@ -198,7 +202,8 @@ async function redirectToSsoProvider(req, res) {
host: redirectToken.host,
path: redirectToken.path,
query: redirectToken.query,
userId: req.session.userId
userId: req.session.userId,
cookieExpires: req.session.cookie.expires
}
var signedJwt = await createJWT(jwtPayload)

Expand Down

0 comments on commit 8c93acb

Please sign in to comment.