diff --git a/server/auth/types/authentication_type.ts b/server/auth/types/authentication_type.ts index 36c61ea32..db148a9c3 100755 --- a/server/auth/types/authentication_type.ts +++ b/server/auth/types/authentication_type.ts @@ -159,7 +159,7 @@ export abstract class AuthenticationType implements IAuthenticationType { } // extend session expiration time - if (this.supportsKeepAlive(request) && this.config.session.keepalive) { + if (await this.supportsKeepAlive(request) && this.config.session.keepalive) { cookie!.expiryTime = Math.max(Date.now() + this.config.session.ttl, cookie.expiryTime || 0); this.sessionStorageFactory.asScoped(request).set(cookie!); } @@ -287,5 +287,10 @@ export abstract class AuthenticationType implements IAuthenticationType { response: LifecycleResponseFactory, toolkit: AuthToolkit ): IOpenSearchDashboardsResponse | AuthResult; + public abstract requestIncludesAuthInfo(request: OpenSearchDashboardsRequest): boolean; + public abstract buildAuthHeaderFromCookie( + cookie: SecuritySessionCookie, + request: OpenSearchDashboardsRequest + ): any public abstract init(): Promise; } diff --git a/server/auth/types/basic/basic_auth.ts b/server/auth/types/basic/basic_auth.ts index 3e14b5f03..85b3f2c05 100644 --- a/server/auth/types/basic/basic_auth.ts +++ b/server/auth/types/basic/basic_auth.ts @@ -137,7 +137,7 @@ export class BasicAuthentication extends AuthenticationType { } } - buildAuthHeaderFromCookie(cookie: SecuritySessionCookie): any { + buildAuthHeaderFromCookie(cookie: SecuritySessionCookie, request: OpenSearchDashboardsRequest): any { if (this.config.auth.anonymous_auth_enabled && cookie.isAnonymousAuth) { return {}; } diff --git a/server/auth/types/proxy/proxy_auth.ts b/server/auth/types/proxy/proxy_auth.ts index 6309c05a0..c35b9c8dd 100644 --- a/server/auth/types/proxy/proxy_auth.ts +++ b/server/auth/types/proxy/proxy_auth.ts @@ -139,7 +139,7 @@ export class ProxyAuthentication extends AuthenticationType { } } - buildAuthHeaderFromCookie(cookie: SecuritySessionCookie): any { + buildAuthHeaderFromCookie(cookie: SecuritySessionCookie, request: OpenSearchDashboardsRequest): any { const authHeaders: any = {}; if (get(cookie.credentials, this.userHeaderName)) { authHeaders[this.userHeaderName] = cookie.credentials[this.userHeaderName];