Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cookieExpires for domain cookies to standardize session expiration #19

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading