Class OAuth2ServiceBindingDestinationLoader
java.lang.Object
com.sap.cloud.sdk.cloudplatform.connectivity.OAuth2ServiceBindingDestinationLoader
- All Implemented Interfaces:
ServiceBindingDestinationLoader
public class OAuth2ServiceBindingDestinationLoader
extends Object
implements ServiceBindingDestinationLoader
An implementation of the
ServiceBindingDestinationLoader interface that is capable of producing OAuth2 based
HttpDestination instances.
This class will automatically be picked up by the service loader pattern.
- Since:
- 4.16.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidregisterPropertySupplier(com.sap.cloud.environment.servicebinding.api.ServiceIdentifier service, Function<ServiceBindingDestinationOptions, OAuth2PropertySupplier> propertySupplier) Adds the givenOAuth2PropertySupplierto handle matchingServiceBindingDestinationOptionsaccording to the providedServiceIdentifier.static voidregisterPropertySupplier(Predicate<ServiceBindingDestinationOptions> optionsMatcher, Function<ServiceBindingDestinationOptions, OAuth2PropertySupplier> propertySupplier) Adds the givenOAuth2PropertySupplierto handle matchingServiceBindingDestinationOptions.io.vavr.control.Try<HttpDestination>Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.sap.cloud.sdk.cloudplatform.connectivity.ServiceBindingDestinationLoader
getDestination
-
Constructor Details
-
OAuth2ServiceBindingDestinationLoader
public OAuth2ServiceBindingDestinationLoader()Default constructor. This will use the static default resolvers which can be modified viaregisterPropertySupplier(Predicate, Function).
-
-
Method Details
-
registerPropertySupplier
public static void registerPropertySupplier(@Nonnull com.sap.cloud.environment.servicebinding.api.ServiceIdentifier service, @Nonnull Function<ServiceBindingDestinationOptions, OAuth2PropertySupplier> propertySupplier) Adds the givenOAuth2PropertySupplierto handle matchingServiceBindingDestinationOptionsaccording to the providedServiceIdentifier. The provided supplier will be checked with higher priority than previously registered suppliers.Note: The order of registering suppliers is important. Therefore, the given
propertySupplierwill be prepended to the list of all registered property suppliers. The first supplier that matches the given options will be used.- Parameters:
service- Theservicethat can be handled by the given property supplier.propertySupplier- TheOAuth2PropertySuppliercapable of parsing bindings for the given service.- See Also:
-
registerPropertySupplier
public static void registerPropertySupplier(@Nonnull Predicate<ServiceBindingDestinationOptions> optionsMatcher, @Nonnull Function<ServiceBindingDestinationOptions, OAuth2PropertySupplier> propertySupplier) Adds the givenOAuth2PropertySupplierto handle matchingServiceBindingDestinationOptions. The provided matcher/supplier combination will be checked with higher priority than previously registered suppliers.Note: The order of registering suppliers is important. Therefore, the given
propertySupplierwill be prepended to the list of all registered property suppliers. The first supplier that matches the given options will be used.- Parameters:
optionsMatcher- ThePredicateto determine wether theServiceBindingDestinationOptionscan be handled by the given property supplier.propertySupplier- TheOAuth2PropertySuppliercapable of parsing bindings for the given service.- Since:
- 4.23.0
-
tryGetDestination
@Nonnull public io.vavr.control.Try<HttpDestination> tryGetDestination(@Nonnull ServiceBindingDestinationOptions options) Description copied from interface:ServiceBindingDestinationLoader- Specified by:
tryGetDestinationin interfaceServiceBindingDestinationLoader- Parameters:
options- TheServiceBindingDestinationOptionsthat contain further context information about how the transformation process should be done.- Returns:
- Either a
Try.success(Object)if the transformation succeeded,Try.failure(Throwable)otherwise.In case of a
Try.failure(Throwable), the cause will either be aDestinationAccessExceptionor aDestinationNotFoundException.
-