UNPKG

@finos/legend-graph

Version:
152 lines 5.37 kB
/** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { CORE_HASH_STRUCTURE } from '../../../../../../../graph/Core_HashUtils.js'; import { hashArray } from '@finos/legend-shared'; export class AuthenticationStrategy { } export class DelegatedKerberosAuthenticationStrategy extends AuthenticationStrategy { serverPrincipal; get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.DELEGRATED_KEREBEROS_AUTHENTICATION_STRATEGY, this.serverPrincipal?.toString() ?? '', ]); } } export class DefaultH2AuthenticationStrategy extends AuthenticationStrategy { get hashCode() { return hashArray([CORE_HASH_STRUCTURE.DEFAULT_H2_AUTHENTICATION_STRATEGY]); } } export class ApiTokenAuthenticationStrategy extends AuthenticationStrategy { apiToken; constructor(apiToken) { super(); this.apiToken = apiToken; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.API_TOKEN_AUTHENTICATION_STRATEGY, this.apiToken, ]); } } export class OAuthAuthenticationStrategy extends AuthenticationStrategy { oauthKey; scopeName; constructor(oauthKey, scopeName) { super(); this.oauthKey = oauthKey; this.scopeName = scopeName; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.OAUTH_AUTHENTICATION_STRATEGY, this.oauthKey, this.scopeName, ]); } } export class SnowflakePublicAuthenticationStrategy extends AuthenticationStrategy { privateKeyVaultReference; passPhraseVaultReference; publicUserName; constructor(privateKeyVaultReference, passPhraseVaultReference, publicUserName) { super(); this.privateKeyVaultReference = privateKeyVaultReference; this.passPhraseVaultReference = passPhraseVaultReference; this.publicUserName = publicUserName; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.SNOWFLAKE_PUBLIC_AUTHENTICATION_STRATEGY, this.privateKeyVaultReference, this.passPhraseVaultReference, this.publicUserName, ]); } } export class GCPApplicationDefaultCredentialsAuthenticationStrategy extends AuthenticationStrategy { get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.GCP_APPLICATION_DEFAULT_CREDENTIALS_AUTHENTICATION_STRATEGY, ]); } } export class GCPWorkloadIdentityFederationAuthenticationStrategy extends AuthenticationStrategy { serviceAccountEmail; additionalGcpScopes = []; constructor(serviceAccountEmail, additionalGcpScopes = []) { super(); this.serviceAccountEmail = serviceAccountEmail; this.additionalGcpScopes = additionalGcpScopes; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.GCP_WORKLOAD_IDENTITY_FEDERATION_AUTHENTICATION_STRATEGY, this.serviceAccountEmail, hashArray(this.additionalGcpScopes), ]); } } export class UsernamePasswordAuthenticationStrategy extends AuthenticationStrategy { baseVaultReference; userNameVaultReference; passwordVaultReference; constructor(userNameVaultReference, passwordVaultReference) { super(); this.userNameVaultReference = userNameVaultReference; this.passwordVaultReference = passwordVaultReference; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.USERNAME_PASSWORD_AUTHENTICATION_STRATEGY, this.baseVaultReference?.toString() ?? '', this.userNameVaultReference, this.passwordVaultReference, ]); } } export class MiddleTierUsernamePasswordAuthenticationStrategy extends AuthenticationStrategy { vaultReference; constructor(vaultReference) { super(); this.vaultReference = vaultReference; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.MIDDLE_TIER_USERNAME_PASSWORD_AUTHENTICATION_STRATEGY, this.vaultReference, ]); } } export class TrinoDelegatedKerberosAuthenticationStrategy extends AuthenticationStrategy { kerberosRemoteServiceName; kerberosUseCanonicalHostname; constructor(kerberosRemoteServiceName, kerberosUseCanonicalHostname) { super(); this.kerberosRemoteServiceName = kerberosRemoteServiceName; this.kerberosUseCanonicalHostname = kerberosUseCanonicalHostname; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.TRINO_DELEGATED_KERBEROS_AUTHENTICATION_STRATEGY, this.kerberosRemoteServiceName, this.kerberosUseCanonicalHostname.toString(), ]); } } //# sourceMappingURL=AuthenticationStrategy.js.map