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

fix: move AuthenticationRequired to types

This commit is contained in:
Ivar Conradi Østhus 2021-04-29 09:57:45 +02:00
parent 65fad95c6f
commit 88a56b8569
No known key found for this signature in database
GPG Key ID: 31AC596886B0BD09
6 changed files with 33 additions and 14 deletions

View File

@ -1,10 +0,0 @@
'use strict';
module.exports = class AuthenticationRequired {
constructor({ type, path, message, options }) {
this.type = type;
this.path = path;
this.message = message;
this.options = options;
}
};

View File

@ -1,4 +1,4 @@
const AuthenticationRequired = require('../authentication-required');
const AuthenticationRequired = require('../types/authentication-required');
function demoAuthentication(app, basePath = '', { userService }) {
app.post(`${basePath}/api/admin/login`, async (req, res) => {

View File

@ -1,4 +1,4 @@
const AuthenticationRequired = require('../authentication-required');
const AuthenticationRequired = require('../types/authentication-required');
function ossAuthHook(app, config) {
const { baseUriPath } = config.server;

View File

@ -13,7 +13,7 @@ import { createConfig } from './create-config';
import User from './types/user';
import permissions from './permissions';
import AuthenticationRequired from './authentication-required';
import AuthenticationRequired from './types/authentication-required';
import eventType from './event-type';
import { addEventHook } from './event-hook';

View File

@ -0,0 +1,29 @@
interface IBaseOptions {
type: string;
path: string;
message: string;
}
interface IOptions extends IBaseOptions {
options: IBaseOptions[];
}
class AuthenticationRequired {
private type: string;
private path: string;
private message: string;
private options: IBaseOptions[];
constructor({ type, path, message, options }: IOptions) {
this.type = type;
this.path = path;
this.message = message;
this.options = options;
}
}
export default AuthenticationRequired;
module.exports = AuthenticationRequired;

View File

@ -2,7 +2,7 @@
const test = require('ava');
const { setupAppWithCustomAuth } = require('../../helpers/test-helper');
const AuthenticationRequired = require('../../../../lib/authentication-required');
const AuthenticationRequired = require('../../../../lib/types/authentication-required');
const dbInit = require('../../helpers/database-init');
const getLogger = require('../../../fixtures/no-logger');