mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #3437 from overleaf/em-project-specific-blobs
Use per-project v1 history blob URLs for git-bridge GitOrigin-RevId: b68ee2129ceb57f4b7f68262c5bcbadc0952b56f
This commit is contained in:
parent
ba2a89c841
commit
55bf16c06d
4 changed files with 28 additions and 0 deletions
22
services/web/app/src/infrastructure/JsonWebToken.js
Normal file
22
services/web/app/src/infrastructure/JsonWebToken.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
const { callbackify, promisify } = require('util')
|
||||||
|
const JWT = require('jsonwebtoken')
|
||||||
|
const Settings = require('settings-sharelatex')
|
||||||
|
|
||||||
|
const jwtSign = promisify(JWT.sign)
|
||||||
|
|
||||||
|
async function sign(payload, options = {}) {
|
||||||
|
const key = Settings.jwt.key
|
||||||
|
const algorithm = Settings.jwt.algorithm
|
||||||
|
if (!key || !algorithm) {
|
||||||
|
throw new Error('missing JWT configuration')
|
||||||
|
}
|
||||||
|
const token = await jwtSign(payload, key, { ...options, algorithm })
|
||||||
|
return token
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
sign: callbackify(sign),
|
||||||
|
promises: {
|
||||||
|
sign
|
||||||
|
}
|
||||||
|
}
|
|
@ -258,6 +258,10 @@ module.exports = settings =
|
||||||
enabled: process.env['TWO_FACTOR_AUTHENTICATION_ENABLED'] == 'true'
|
enabled: process.env['TWO_FACTOR_AUTHENTICATION_ENABLED'] == 'true'
|
||||||
requiredForStaff: process.env['TWO_FACTOR_AUTHENTICATION_REQUIRED_FOR_STAFF'] == 'true'
|
requiredForStaff: process.env['TWO_FACTOR_AUTHENTICATION_REQUIRED_FOR_STAFF'] == 'true'
|
||||||
|
|
||||||
|
jwt:
|
||||||
|
key: process.env['OT_JWT_AUTH_KEY']
|
||||||
|
algorithm: process.env['OT_JWT_AUTH_ALG'] || 'HS256'
|
||||||
|
|
||||||
# Default features
|
# Default features
|
||||||
# ----------------
|
# ----------------
|
||||||
#
|
#
|
||||||
|
|
|
@ -33,6 +33,7 @@ services:
|
||||||
COOKIE_DOMAIN: .overleaf.test
|
COOKIE_DOMAIN: .overleaf.test
|
||||||
PUBLIC_URL: 'http://www.overleaf.test:3000'
|
PUBLIC_URL: 'http://www.overleaf.test:3000'
|
||||||
HTTP_TEST_HOST: www.overleaf.test
|
HTTP_TEST_HOST: www.overleaf.test
|
||||||
|
OT_JWT_AUTH_KEY: "very secret key"
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- 'www.overleaf.test:127.0.0.1'
|
- 'www.overleaf.test:127.0.0.1'
|
||||||
command: npm run test:acceptance:app
|
command: npm run test:acceptance:app
|
||||||
|
|
|
@ -42,6 +42,7 @@ services:
|
||||||
COOKIE_DOMAIN: .overleaf.test
|
COOKIE_DOMAIN: .overleaf.test
|
||||||
PUBLIC_URL: 'http://www.overleaf.test:3000'
|
PUBLIC_URL: 'http://www.overleaf.test:3000'
|
||||||
HTTP_TEST_HOST: www.overleaf.test
|
HTTP_TEST_HOST: www.overleaf.test
|
||||||
|
OT_JWT_AUTH_KEY: "very secret key"
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- 'www.overleaf.test:127.0.0.1'
|
- 'www.overleaf.test:127.0.0.1'
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
Loading…
Reference in a new issue