From f63bbf2e58c6d3abea2fc103dd4733e0ad4d9822 Mon Sep 17 00:00:00 2001 From: Darshit Chanpura Date: Wed, 20 Mar 2024 21:36:07 -0400 Subject: [PATCH] Fixes linter errors Signed-off-by: Darshit Chanpura --- common/index.ts | 1 - server/auth/types/basic/basic_auth.ts | 2 +- server/auth/types/basic/routes.ts | 2 +- server/auth/types/saml/routes.ts | 7 ++++++- server/backend/opensearch_security_client.ts | 3 +-- test/jest_integration/basic_auth.test.ts | 6 ++---- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/common/index.ts b/common/index.ts index 482ce6ecb..f08bb0fa0 100644 --- a/common/index.ts +++ b/common/index.ts @@ -39,7 +39,6 @@ export const ANONYMOUS_AUTH_LOGIN = '/auth/anonymous'; export const AUTH_REQUEST_TYPE_HEADER = 'auth_request_type'; export const SAML_AUTH_REQUEST_TYPE = 'saml'; - export const OPENID_AUTH_LOGOUT = '/auth/openid/logout'; export const SAML_AUTH_LOGOUT = '/auth/saml/logout'; export const ANONYMOUS_AUTH_LOGOUT = '/auth/anonymous/logout'; diff --git a/server/auth/types/basic/basic_auth.ts b/server/auth/types/basic/basic_auth.ts index 4bea50c15..2838047f5 100644 --- a/server/auth/types/basic/basic_auth.ts +++ b/server/auth/types/basic/basic_auth.ts @@ -130,7 +130,7 @@ export class BasicAuthentication extends AuthenticationType { request: OpenSearchDashboardsRequest ): any { if (this.config.auth.anonymous_auth_enabled && cookie.isAnonymousAuth) { - return { }; + return {}; } const headers: any = {}; Object.assign(headers, { authorization: cookie.credentials?.authHeaderValue }); diff --git a/server/auth/types/basic/routes.ts b/server/auth/types/basic/routes.ts index 0319ac2ea..bae3e338c 100755 --- a/server/auth/types/basic/routes.ts +++ b/server/auth/types/basic/routes.ts @@ -186,7 +186,7 @@ export class BasicAuthRoutes { } context.security_plugin.logger.info('The Redirect Path is ' + redirectUrl); try { - user = await this.securityClient.authenticateWithHeaders(request, { }); + user = await this.securityClient.authenticateWithHeaders(request, {}); } catch (error) { context.security_plugin.logger.error( `Failed authentication: ${error}. Redirecting to Login Page` diff --git a/server/auth/types/saml/routes.ts b/server/auth/types/saml/routes.ts index dc0208057..5e3016765 100644 --- a/server/auth/types/saml/routes.ts +++ b/server/auth/types/saml/routes.ts @@ -20,7 +20,12 @@ import { SecurityPluginConfigType } from '../../..'; import { SecurityClient } from '../../../backend/opensearch_security_client'; import { CoreSetup } from '../../../../../../src/core/server'; import { validateNextUrl } from '../../../utils/next_url'; -import { AuthType, SAML_AUTH_LOGIN, SAML_AUTH_LOGOUT, SAML_AUTH_REQUEST_TYPE } from '../../../../common'; +import { + AuthType, + SAML_AUTH_LOGIN, + SAML_AUTH_LOGOUT, + SAML_AUTH_REQUEST_TYPE, +} from '../../../../common'; import { clearSplitCookies, diff --git a/server/backend/opensearch_security_client.ts b/server/backend/opensearch_security_client.ts index 70965acc2..6e4f356fb 100755 --- a/server/backend/opensearch_security_client.ts +++ b/server/backend/opensearch_security_client.ts @@ -18,7 +18,6 @@ import { User } from '../auth/user'; import { TenancyConfigSettings } from '../../public/apps/configuration/panels/tenancy-config/types'; import { AUTH_REQUEST_TYPE_HEADER, SAML_AUTH_REQUEST_TYPE } from '../../common'; - export class SecurityClient { constructor(private readonly esClient: ILegacyClusterClient) {} @@ -55,7 +54,7 @@ export class SecurityClient { headerValue: string, authRequestType: string | undefined, whitelistedHeadersAndValues: any = {}, - additionalAuthHeaders: any = {}, + additionalAuthHeaders: any = {} ): Promise { try { const credentials: any = { diff --git a/test/jest_integration/basic_auth.test.ts b/test/jest_integration/basic_auth.test.ts index f1f5ae16f..24c1021a8 100644 --- a/test/jest_integration/basic_auth.test.ts +++ b/test/jest_integration/basic_auth.test.ts @@ -139,8 +139,7 @@ describe('start OpenSearch Dashboards server', () => { }); it('can access home page as anonymous user', async () => { - const response = await osdTestServer.request - .get(root, '/app/home#/'); + const response = await osdTestServer.request.get(root, '/app/home#/'); expect(response.status).toEqual(200); }); @@ -160,8 +159,7 @@ describe('start OpenSearch Dashboards server', () => { }); it('call authinfo API as anonymous user', async () => { - const response = await osdTestServer.request - .get(root, '/api/v1/auth/authinfo'); + const response = await osdTestServer.request.get(root, '/api/v1/auth/authinfo'); expect(response.status).toEqual(200); });