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

Change the default session duration to 1 day #80

Merged
merged 1 commit into from
Mar 30, 2020
Merged
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.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Additional configuration keys that can be passed to `auth()` on initialization:

- **`appSession`** - Object defining application session configuration. If this is set to `false`, the internal storage will not be used (see [this example](https://github.com/auth0/express-openid-connect/blob/master/EXAMPLES.md#4-custom-user-session-handling) for how to provide your own session mechanism). Otherwise, the `secret` key is required (see above).
- **`appSession.secret`** - See the **Required Keys** section above.
- **`appSession.duration`** - Integer value, in seconds, for application session duration. Default is 7 days.
- **`appSession.duration`** - Integer value, in seconds, for application session duration. Default is 1 day.
- **`appSession.name`** - String value for the cookie name used for the internal session. This value must only include letters, numbers, and underscores. Default is `appSession`.
- **`appSession.cookieTransient`** - Sets the application session cookie expiration to `0` to create a transient cookie. Set to `false` by default.
- **`appSession.cookieDomain`** - Passed to the [Response cookie](https://expressjs.com/en/api.html#res.cookie) as `domain`.
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ interface AppSessionConfigParams {

/**
* Integer value, in seconds, for application session duration.
* Default is 604800 seconds (7 days).
* Default is 86400 seconds (1 day).
*/
duration?: number

Expand Down
2 changes: 1 addition & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { defaultState: getLoginState } = require('./hooks/getLoginState');
const getUser = require('./hooks/getUser');
const handleCallback = require('./hooks/handleCallback');

const sessionDurationDefault = (7 * 24 * 60 * 60); // 7 days
const sessionDurationDefault = (24 * 60 * 60); // 1 day
const sessionNameDefault = 'appSession';

const paramsSchema = Joi.object({
Expand Down
4 changes: 2 additions & 2 deletions test/config.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ describe('config', function() {
assert.equal(config.appSession.secret, '__test_session_secret__');
});

it('should set the session length to 7 days by default', function() {
assert.equal(config.appSession.duration, 604800);
it('should set the session length to 1 day by default', function() {
assert.equal(config.appSession.duration, 86400);
});

it('should set the session name to "appSession" by default', function() {
Expand Down