From c78e1afc2ddfaf5dae98c4b6b45743e845f7d4ad Mon Sep 17 00:00:00 2001 From: yubonluo Date: Thu, 20 Jun 2024 13:26:16 +0800 Subject: [PATCH] optimize the annotation Signed-off-by: yubonluo --- server/auth/types/authentication_type.test.ts | 4 ++-- server/auth/types/authentication_type.ts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/server/auth/types/authentication_type.test.ts b/server/auth/types/authentication_type.test.ts index 53f515972..0274251dc 100644 --- a/server/auth/types/authentication_type.test.ts +++ b/server/auth/types/authentication_type.test.ts @@ -134,7 +134,7 @@ describe('test capabilities request authinfo', () => { asScoped: jest.fn().mockImplementation(() => { return { callAsCurrentUser: jest.fn().mockImplementation(() => { - return { username: 'capabolities-username' }; + return { username: 'capabilities-username' }; }), }; }), @@ -162,6 +162,6 @@ describe('test capabilities request authinfo', () => { authenticated: jest.fn((value) => value), }; const result = await dummyAuthType.authHandler(request, response, toolkit); - expect(result.state.authInfo.username).toEqual('capabolities-username'); + expect(result.state.authInfo.username).toEqual('capabilities-username'); }); }); diff --git a/server/auth/types/authentication_type.ts b/server/auth/types/authentication_type.ts index f649d8387..5bb16cd74 100755 --- a/server/auth/types/authentication_type.ts +++ b/server/auth/types/authentication_type.ts @@ -151,7 +151,7 @@ export abstract class AuthenticationType implements IAuthenticationType { return toolkit.notHandled(); } - // Before users login, skip auth capabilities request. + // allow optional authentication if (this.authOptional(request)) { return toolkit.authenticated(); } @@ -244,7 +244,6 @@ export abstract class AuthenticationType implements IAuthenticationType { if (!pathname) { return false; } - // allow requests to ignored routes if (AuthenticationType.ROUTES_AUTH_OPTIONAL.includes(pathname!)) { return true; }