mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-03 01:18:43 +02:00
fix: enable demo-authentication (#796)
This commit is contained in:
parent
cc1b328b07
commit
05abb7e295
@ -102,7 +102,7 @@
|
|||||||
"prom-client": "^13.1.0",
|
"prom-client": "^13.1.0",
|
||||||
"response-time": "^2.3.2",
|
"response-time": "^2.3.2",
|
||||||
"serve-favicon": "^2.5.0",
|
"serve-favicon": "^2.5.0",
|
||||||
"unleash-frontend": "4.0.0-alpha.6",
|
"unleash-frontend": "4.0.0-alpha.7",
|
||||||
"uuid": "^8.3.2",
|
"uuid": "^8.3.2",
|
||||||
"yargs": "^16.0.3"
|
"yargs": "^16.0.3"
|
||||||
},
|
},
|
||||||
|
@ -18,7 +18,7 @@ import unleashDbSession from './middleware/session-db';
|
|||||||
import IndexRouter from './routes';
|
import IndexRouter from './routes';
|
||||||
|
|
||||||
import requestLogger from './middleware/request-logger';
|
import requestLogger from './middleware/request-logger';
|
||||||
import simpleAuthentication from './middleware/simple-authentication';
|
import demoAuthentication from './middleware/demo-authentication';
|
||||||
import ossAuthentication from './middleware/oss-authentication';
|
import ossAuthentication from './middleware/oss-authentication';
|
||||||
import noAuthentication from './middleware/no-authentication';
|
import noAuthentication from './middleware/no-authentication';
|
||||||
import secureHeaders from './middleware/secure-headers';
|
import secureHeaders from './middleware/secure-headers';
|
||||||
@ -74,7 +74,7 @@ export default function getApp(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IAuthType.DEMO: {
|
case IAuthType.DEMO: {
|
||||||
simpleAuthentication(app, config.server.baseUriPath, services);
|
demoAuthentication(app, config.server.baseUriPath, services);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IAuthType.CUSTOM: {
|
case IAuthType.CUSTOM: {
|
||||||
@ -87,7 +87,7 @@ export default function getApp(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
simpleAuthentication(app, config.server.baseUriPath, services);
|
demoAuthentication(app, config.server.baseUriPath, services);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ const auth = require('basic-auth');
|
|||||||
const User = require('../user');
|
const User = require('../user');
|
||||||
const AuthenticationRequired = require('../authentication-required');
|
const AuthenticationRequired = require('../authentication-required');
|
||||||
|
|
||||||
function insecureAuthentication(app, basePath = '', { userService }) {
|
function demoAuthentication(app, basePath = '', { userService }) {
|
||||||
app.post(`${basePath}/api/admin/login`, async (req, res) => {
|
app.post(`${basePath}/api/admin/login`, async (req, res) => {
|
||||||
const { email } = req.body;
|
const { email } = req.body;
|
||||||
const user = await userService.loginUserWithoutPassword(email, true);
|
const user = await userService.loginUserWithoutPassword(email, true);
|
||||||
@ -33,7 +33,7 @@ function insecureAuthentication(app, basePath = '', { userService }) {
|
|||||||
.json(
|
.json(
|
||||||
new AuthenticationRequired({
|
new AuthenticationRequired({
|
||||||
path: `${basePath}/api/admin/login`,
|
path: `${basePath}/api/admin/login`,
|
||||||
type: 'unsecure',
|
type: 'demo',
|
||||||
message:
|
message:
|
||||||
'You have to identify yourself in order to use Unleash.',
|
'You have to identify yourself in order to use Unleash.',
|
||||||
}),
|
}),
|
||||||
@ -42,4 +42,4 @@ function insecureAuthentication(app, basePath = '', { userService }) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = insecureAuthentication;
|
module.exports = demoAuthentication;
|
@ -6882,10 +6882,10 @@ universalify@^0.1.0:
|
|||||||
resolved "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz"
|
resolved "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz"
|
||||||
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
|
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
|
||||||
|
|
||||||
unleash-frontend@4.0.0-alpha.6:
|
unleash-frontend@4.0.0-alpha.7:
|
||||||
version "4.0.0-alpha.6"
|
version "4.0.0-alpha.7"
|
||||||
resolved "https://registry.yarnpkg.com/unleash-frontend/-/unleash-frontend-4.0.0-alpha.6.tgz#313cd3544bf74da221a85251b82c9ac7ef2ed59d"
|
resolved "https://registry.yarnpkg.com/unleash-frontend/-/unleash-frontend-4.0.0-alpha.7.tgz#bee86ea40471b3ffbdf7880506b219a7e25e68b4"
|
||||||
integrity sha512-ZhfFyHCBdLI99PCxtNKVSsHWooamNRvHlzofkKtcf2su4nSQcryTfjskI9H04BcbBCGBZcEE3stqRIpyymKNYg==
|
integrity sha512-WW3LU8/2T0zUPVn0JMvlwLpFYP3YvB+JbagMUXhM+BaSN7xIUWUGcfEdmbyk7e3pDs0g7wIPZjjtZ++C5DT4KA==
|
||||||
|
|
||||||
unpipe@1.0.0, unpipe@~1.0.0:
|
unpipe@1.0.0, unpipe@~1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user