/**
 * Copyright (c) 2020, 2021 Oracle and/or its affiliates.  All rights reserved.
 * This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
 */ import { Region } from "../region" ; import AbstractAuthenticationDetailsProvider from "./models/abstract-authentication-details-provider" ; import { ConfigAccumulator } from "../config-file-reader" ; /**
 * An interface provides the authentication details.
 */ export interface AuthenticationDetailsProvider extends AbstractAuthenticationDetailsProvider { /**
     * Get the key id to sign the http request.
     */ getKeyId ( ) : Promise < string > ; /**
     * Get the private key to sign the http request.
     */ getPrivateKey ( ) : string ; /**
     * Get the passphrase of the private key to sign the http request.
     */ getPassphrase ( ) : string | null ; /**
     * Get the auth type of this authentication provider
     */ getAuthType ? ( ) : string | undefined ; /**
     * Get the true authentication provider
     */ getProvider ? ( ) : AuthenticationDetailsProvider ; /**
     * Set the provider
     */ setProvider ? ( provider ) : void ; /**
     * Get the delegation token
     */ getDelegationToken ? ( ) : string | undefined ; } export interface RegionProvider { return getRegion ( ) : Region ; } export function isRegionProvider ( arg ) { return arg . getRegion !== undefined ; } /**
 * The API based authentication details provider which implements [[AuthenticationDetailsProvider]].
 */ export class SimpleAuthenticationDetailsProvider implements AuthenticationDetailsProvider , RegionProvider { private provider : AuthenticationDetailsProvider = ( null as unknown ) as AuthenticationDetailsProvider ; param tenancy param user param fingerprint param privateKey param passphrase constructor ( private tenancy , private user , private fingerprint , private privateKey , private passphrase , private region ? , private authType ? , private delegationToken ? , private profileCredentials ? ) { } /**
     * Get the key id to sign the http request.
     */ public async getKeyId ( ) { return this . tenancy + "/" + this . user + "/" + this . fingerprint ; } /**
     * Get the private key to sign the http request.
     */ public getPrivateKey ( ) { return this . privateKey ; } /**
     * Get the passphrase of the private key to sign the http request.
     */ public getPassphrase ( ) { return this . passphrase ; } /**
     * Get the Tenancy
     */ public getTenantId ( ) { return this . tenancy ; } /**
     * Get the user
     */ public getUser ( ) { return this . user ; } /**
     * Get the fingerprint
     */ public getFingerprint ( ) { return this . fingerprint ; } /**
     * Get the region
     */ public getRegion ( ) { return this . region ! ; } /**
     * Set the region
     */ public setRegion ( region ) { this . region = region ; } /**
     * Get the authType
     */ public getAuthType ( ) { return this . authType ; } /**
     * Set the provider
     */ public setProvider ( provider ) { this . provider = provider ; } /**
     * Get the provider
     */ public getProvider ( ) { return this . provider ; } /**
     * Get the delegation token
     */ public getDelegationToken ( ) { return this . delegationToken ; } public getProfileCredentials ( ) { return this . profileCredentials ; } }