1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

fix: enable demo-authentication (#796)

This commit is contained in:
Ivar Conradi Østhus 2021-04-22 10:53:47 +02:00 committed by GitHub
parent cc1b328b07
commit 05abb7e295
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

View File

@ -102,7 +102,7 @@
"prom-client": "^13.1.0",
"response-time": "^2.3.2",
"serve-favicon": "^2.5.0",
"unleash-frontend": "4.0.0-alpha.6",
"unleash-frontend": "4.0.0-alpha.7",
"uuid": "^8.3.2",
"yargs": "^16.0.3"
},

View File

@ -18,7 +18,7 @@ import unleashDbSession from './middleware/session-db';
import IndexRouter from './routes';
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 noAuthentication from './middleware/no-authentication';
import secureHeaders from './middleware/secure-headers';
@ -74,7 +74,7 @@ export default function getApp(
break;
}
case IAuthType.DEMO: {
simpleAuthentication(app, config.server.baseUriPath, services);
demoAuthentication(app, config.server.baseUriPath, services);
break;
}
case IAuthType.CUSTOM: {
@ -87,7 +87,7 @@ export default function getApp(
break;
}
default: {
simpleAuthentication(app, config.server.baseUriPath, services);
demoAuthentication(app, config.server.baseUriPath, services);
break;
}
}

View File

@ -2,7 +2,7 @@ const auth = require('basic-auth');
const User = require('../user');
const AuthenticationRequired = require('../authentication-required');
function insecureAuthentication(app, basePath = '', { userService }) {
function demoAuthentication(app, basePath = '', { userService }) {
app.post(`${basePath}/api/admin/login`, async (req, res) => {
const { email } = req.body;
const user = await userService.loginUserWithoutPassword(email, true);
@ -33,7 +33,7 @@ function insecureAuthentication(app, basePath = '', { userService }) {
.json(
new AuthenticationRequired({
path: `${basePath}/api/admin/login`,
type: 'unsecure',
type: 'demo',
message:
'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;

View File

@ -6882,10 +6882,10 @@ universalify@^0.1.0:
resolved "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz"
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
unleash-frontend@4.0.0-alpha.6:
version "4.0.0-alpha.6"
resolved "https://registry.yarnpkg.com/unleash-frontend/-/unleash-frontend-4.0.0-alpha.6.tgz#313cd3544bf74da221a85251b82c9ac7ef2ed59d"
integrity sha512-ZhfFyHCBdLI99PCxtNKVSsHWooamNRvHlzofkKtcf2su4nSQcryTfjskI9H04BcbBCGBZcEE3stqRIpyymKNYg==
unleash-frontend@4.0.0-alpha.7:
version "4.0.0-alpha.7"
resolved "https://registry.yarnpkg.com/unleash-frontend/-/unleash-frontend-4.0.0-alpha.7.tgz#bee86ea40471b3ffbdf7880506b219a7e25e68b4"
integrity sha512-WW3LU8/2T0zUPVn0JMvlwLpFYP3YvB+JbagMUXhM+BaSN7xIUWUGcfEdmbyk7e3pDs0g7wIPZjjtZ++C5DT4KA==
unpipe@1.0.0, unpipe@~1.0.0:
version "1.0.0"