diff --git a/cloudplatform/cloudplatform-connectivity/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/BtpServiceOptions.java b/cloudplatform/cloudplatform-connectivity/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/BtpServiceOptions.java index 3d06f4cc5..daf6edf89 100644 --- a/cloudplatform/cloudplatform-connectivity/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/BtpServiceOptions.java +++ b/cloudplatform/cloudplatform-connectivity/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/BtpServiceOptions.java @@ -211,21 +211,73 @@ public static OptionsEnhancer withoutTokenForTechnicalProviderUser() } /** - * Creates an {@link OptionsEnhancer} that instructs an IAS-based destination to use the given application - * provider name when performing token retrievals. This is needed in App-To-App communication scenarios. + * Creates an {@link OptionsEnhancer} that instructs an IAS-based destination to use the given "Dependency Name" + * when performing token retrievals. This is needed in App-To-App communication scenarios. *

* Hint: This option is mutually exclusive with {@link #withConsumerClient(String)}. * * @param applicationName - * The name of the application provider to be used. This is the name that was used to register the - * to-be-called application within the IAS tenant. + * The name of the "Dependency Name" to be used. This is the name that was used to register the + * dependency to an API of a provider application within the IAS tenant. * @return An instance of {@link OptionsEnhancer} that will lead to the given application provider being used * when retrieving an authentication token from the IAS service. + * + * @see Consuming + * APIs from Other Applications */ @Nonnull public static OptionsEnhancer withApplicationName( @Nonnull final String applicationName ) { - return new IasCommunicationOptions(applicationName, null, null); + return new IasCommunicationOptions(applicationName, null, null, null, null); + } + + /** + * Creates an {@link OptionsEnhancer} that instructs an IAS-based destination to use the given provider client + * ID when performing token retrievals. This is needed in App-To-App communication scenarios. + *

+ * Hint: This option is mutually exclusive with {@link #withConsumerClient(String)}. + * + * @param providerClientId + * Client ID of the provider application + * @return An instance of {@link OptionsEnhancer} that will lead to the given application provider being used + * when retrieving an authentication token from the IAS service. + * + * @see Consuming + * APIs from Other Applications + */ + @Nonnull + public static OptionsEnhancer withProviderClient( @Nonnull final String providerClientId ) + { + return new IasCommunicationOptions(null, providerClientId, null, null, null); + } + + /** + * Creates an {@link OptionsEnhancer} that instructs an IAS-based destination to use the given provider client + * ID and provider tenant ID when performing token retrievals. This is needed in App-To-App communication + * scenarios when having dependencies to different tenants of the same, multi-tenant provider + * application (fan-out / 1-N). + *

+ * Hint: This option is mutually exclusive with {@link #withConsumerClient(String)} + * + * @param providerClientId + * Client ID of the provider application + * @param providerTenantId + * Tenant ID of the provider application + * @return An instance of {@link OptionsEnhancer} that will lead to the given application provider being used + * when retrieving an authentication token from the IAS service. + * + * @see Consuming + * APIs from Other Applications + */ + @Nonnull + public static + OptionsEnhancer + withProviderClient( @Nonnull final String providerClientId, @Nonnull final String providerTenantId ) + { + return new IasCommunicationOptions(null, providerClientId, providerTenantId, null, null); } /** @@ -243,7 +295,7 @@ public static OptionsEnhancer withApplicationName( @Nonnull final String appl @Nonnull public static OptionsEnhancer withConsumerClient( @Nonnull final String consumerClientId ) { - return new IasCommunicationOptions(null, consumerClientId, null); + return new IasCommunicationOptions(null, null, null, consumerClientId, null); } /** @@ -269,7 +321,7 @@ public static OptionsEnhancer withConsumerClient( @Nonnull final String consu OptionsEnhancer withConsumerClient( @Nonnull final String consumerClientId, @Nonnull final String consumerTenantId ) { - return new IasCommunicationOptions(null, consumerClientId, consumerTenantId); + return new IasCommunicationOptions(null, null, null, consumerClientId, consumerTenantId); } /** @@ -315,6 +367,10 @@ public static class IasCommunicationOptions implements OptionsEnhancer