Skip to content

Commit

Permalink
fix: enable demo-authentication (#796)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivarconr committed Apr 22, 2021
1 parent cc1b328 commit 05abb7e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
6 changes: 3 additions & 3 deletions src/lib/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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: {
Expand All @@ -87,7 +87,7 @@ export default function getApp(
break;
}
default: {
simpleAuthentication(app, config.server.baseUriPath, services);
demoAuthentication(app, config.server.baseUriPath, services);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.',
}),
Expand All @@ -42,4 +42,4 @@ function insecureAuthentication(app, basePath = '', { userService }) {
});
}

module.exports = insecureAuthentication;
module.exports = demoAuthentication;
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 05abb7e

Please sign in to comment.