mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: move AuthenticationRequired to types
This commit is contained in:
		
							parent
							
								
									65fad95c6f
								
							
						
					
					
						commit
						88a56b8569
					
				| @ -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; | ||||
|     } | ||||
| }; | ||||
| @ -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) => { | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| const AuthenticationRequired = require('../authentication-required'); | ||||
| const AuthenticationRequired = require('../types/authentication-required'); | ||||
| 
 | ||||
| function ossAuthHook(app, config) { | ||||
|     const { baseUriPath } = config.server; | ||||
|  | ||||
| @ -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'; | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										29
									
								
								src/lib/types/authentication-required.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								src/lib/types/authentication-required.ts
									
									
									
									
									
										Normal 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; | ||||
| @ -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'); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user