Skip to content

Commit

Permalink
Extend token expiry time (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
irdkwmnsb authored Nov 26, 2024
1 parent 55a0c0d commit 914f86f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/units/auth/ldap.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as pathutil from '../../util/pathutil.cjs'
import * as urlutil from '../../util/urlutil.js'
import lifecycle from '../../util/lifecycle.js'
import rateLimitConfig from '../ratelimit/index.js'
import {ONE_DAY} from '../../util/apiutil.js'
export default (function(options) {
var log = logger.createLogger('auth-ldap')
var app = express()
Expand Down Expand Up @@ -89,7 +90,7 @@ export default (function(options) {
}
, secret: options.secret
, header: {
exp: Date.now() + 24 * 3600
exp: Date.now() + ONE_DAY
}
})
res.status(200)
Expand Down
3 changes: 2 additions & 1 deletion lib/units/auth/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as pathutil from '../../util/pathutil.cjs'
import * as urlutil from '../../util/urlutil.js'
import lifecycle from '../../util/lifecycle.js'
import rateLimitConfig from '../ratelimit/index.js'
import {ONE_DAY} from '../../util/apiutil.js'
export default (function(options) {
var log = logger.createLogger('auth-mock')
var app = express()
Expand Down Expand Up @@ -108,7 +109,7 @@ export default (function(options) {
}
, secret: options.secret
, header: {
exp: Date.now() + 24 * 3600
exp: Date.now() + ONE_DAY
}
})
res.status(200)
Expand Down
3 changes: 2 additions & 1 deletion lib/units/auth/oauth2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as jwtutil from '../../../util/jwtutil.js'
import Strategy from './strategy.js'
import rateLimitConfig from '../../ratelimit/index.js'
import * as dbapi from '../../../db/api.js'
import {ONE_DAY} from '../../../util/apiutil.js'
export default (function(options) {
var log = logger.createLogger('auth-oauth2')
var app = express()
Expand Down Expand Up @@ -65,7 +66,7 @@ export default (function(options) {
}
, secret: options.secret
, header: {
exp: Date.now() + 24 * 3600
exp: Date.now() + ONE_DAY
}
})
}))
Expand Down
3 changes: 2 additions & 1 deletion lib/units/auth/saml2.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as urlutil from '../../util/urlutil.js'
import * as jwtutil from '../../util/jwtutil.js'
import rateLimitConfig from '../ratelimit/index.js'
import * as dbapi from '../../db/api.js'
import {ONE_DAY} from '../../util/apiutil.js'
var SamlStrategy = {Strategy: passportSaml}.Strategy
export default (function(options) {
var log = logger.createLogger('auth-saml2')
Expand Down Expand Up @@ -74,7 +75,7 @@ export default (function(options) {
}
, secret: options.secret
, header: {
exp: Date.now() + 24 * 3600
exp: Date.now() + ONE_DAY
}
})
}))
Expand Down
2 changes: 2 additions & 0 deletions lib/util/jwtutil.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import assert from 'assert'
import * as jws from 'jws'
import _ from 'lodash'
import {ONE_MONTH} from './apiutil.js'
export const encode = function(options) {
assert.ok(options.payload, 'payload required')
assert.ok(options.secret, 'secret required')
let header = {
alg: 'HS256'
, exp: Date.now() + ONE_MONTH
}
if (options.header) {
header = _.merge(header, options.header)
Expand Down

0 comments on commit 914f86f

Please sign in to comment.