Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

introduced the jwt expiry for forced logout of users; defaulting to 1 hour, overridable by env. variable KONGA_JWT_TOKEN_EXPIRY #468

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion api/policies/authenticated.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = function authenticated(request, response, next) {
return response.json(401, {message: 'Given authorization token is not valid', logout: true});
} else {
// Store user id to request object
request.token = token;
request.token = token.id.toString();

// We delete the token from query and body to not mess with blueprints
request.query && delete request.query.token;
Expand Down
3 changes: 2 additions & 1 deletion api/services/Token.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ module.exports.issue = function issue(payload) {

return jwt.sign(
payload, // This is the payload we want to put inside the token
process.env.TOKEN_SECRET || "oursecret" // Secret string which will be used to sign the token
process.env.TOKEN_SECRET || "oursecret", // Secret string which will be used to sign the token
{ expiresIn: parseInt(process.env.KONGA_JWT_TOKEN_EXPIRY || 60 * 60 )}
);
};

Expand Down