UNPKG

@sap-cloud-sdk/connectivity

Version:

SAP Cloud SDK for JavaScript connectivity

56 lines (55 loc) 2.74 kB
import type { SubscriberToken } from './get-subscriber-token'; import type { Destination } from './destination-service-types'; import type { DestinationFetchOptions } from './destination-accessor-types'; import type { JwtPair } from '../jwt'; /** * Retrieves a destination with the given name from the Cloud Foundry destination service. * Returns `null`, if no destination can be found. * Requires the following service bindings: destination, XSUAA * By default, selects subscriber over provider and instance over subaccount destinations. * @param options - Configuration for how to retrieve destinations from the destination service. * @returns A promise returning the requested destination on success. */ export declare function getDestinationFromDestinationService(options: DestinationFetchOptions): Promise<Destination | null>; /** * @internal */ export declare class DestinationFromServiceRetriever { readonly subscriberToken: SubscriberToken | undefined; readonly providerServiceToken: JwtPair; static getDestinationFromDestinationService(options: DestinationFetchOptions): Promise<Destination | null>; private static throwUserTokenMissing; private static checkDestinationForCustomJwt; private static isUserJwt; private options; private constructor(); private searchDestinationWithSelectionStrategyAndCache; private getExchangeTenant; private getAuthTokenForOAuth2ClientCredentials; private usesSystemUser; private getAuthTokenForOAuth2UserBasedTokenExchanges; private getAuthTokenForOAuth2RefreshToken; /** * @internal * This method calls the 'find destination by name' endpoint of the destination service using a client credentials grant. * For the find by name endpoint, the destination service will take care of OAuth flows and include the token in the destination. * @param destination - The destination for which the token should be fetched. * @param origin - The origin of the destination, either 'subscriber' or 'provider'. * @returns Destination containing the auth token. */ private fetchDestinationWithNonUserExchangeFlows; private fetchDestinationWithUserExchangeFlows; private fetchDestinationWithRefreshTokenFlow; private fetchAndAddAuthTokenIfNeeded; private addProxyConfiguration; private cacheDestination; private getProviderDestinationService; private getProviderDestinationCache; private getSubscriberDestinationService; private getSubscriberDestinationCache; private isProviderNeeded; private isSubscriberNeeded; private searchProviderAccountForDestination; private searchSubscriberAccountForDestination; private addTrustStoreConfigurationIfNeeded; }