@Beta public class ScpCfService extends Object
Be aware that this class is in Beta (as indicated by the annotation) and therefore subject to breaking changes.
| Constructor and Description |
|---|
ScpCfService(ScpCfServiceInfo serviceInfo,
URI authUri,
BasicCredentials clientCredentials,
String serviceLocationInfo)
Constructor open for extension.
|
ScpCfService(ScpCfServiceInfo serviceInfo,
URI authUri,
BasicCredentials clientCredentials,
String serviceLocationInfo,
boolean useProviderTenant)
Constructor open for extension.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.http.HttpRequest |
addBearerTokenHeader(org.apache.http.HttpRequest request)
Configures a provided request to the service to bear required authentication token.
|
URI |
getAuthUri()
The oauth server url from the service config.
|
BasicCredentials |
getClientCredentials() |
ScpCfServiceInfo |
getServiceInfo()
Provides access to the rest of the service info.
|
String |
getServiceLocationInfo()
Service access.
|
static ScpCfService |
of(ScpCfServiceDesignator designator,
String authUrlJsonPath,
String clientIdJsonPath,
String clientSecretJsonPath,
String serviceLocationJsonPath)
Factory method reading information about service from VCAP_SERVICES.
|
static ScpCfService |
of(String serviceType,
String servicePlan,
String authUrlJsonPath,
String clientIdJsonPath,
String clientSecretJsonPath,
String serviceLocationJsonPath)
Factory method reading information about service from VCAP_SERVICES.
|
static ScpCfService |
ofMultiTenant(ScpCfServiceDesignator designator,
String authUrlJsonPath,
String clientIdJsonPath,
String clientSecretJsonPath,
String serviceLocationJsonPath,
boolean useProviderTenant)
Factory method reading information about service from VCAP_SERVICES.
|
static ScpCfService |
ofMultiTenant(String serviceType,
String servicePlan,
String authUrlJsonPath,
String clientIdJsonPath,
String clientSecretJsonPath,
String serviceLocationJsonPath,
boolean useProviderTenant)
Factory method reading information about service from VCAP_SERVICES.
|
String |
toString() |
public ScpCfService(@Nonnull ScpCfServiceInfo serviceInfo, @Nonnull URI authUri, @Nonnull BasicCredentials clientCredentials, @Nonnull String serviceLocationInfo)
serviceInfo - json from the VCAP_SERVICESauthUri - OAuth authentication serviceclientCredentials - credentials for authentications to OAuth serviceserviceLocationInfo - url or host of the service represented by this objectpublic ScpCfService(@Nonnull ScpCfServiceInfo serviceInfo, @Nonnull URI authUri, @Nonnull BasicCredentials clientCredentials, @Nonnull String serviceLocationInfo, boolean useProviderTenant)
serviceInfo - json from the VCAP_SERVICESauthUri - OAuth authentication serviceclientCredentials - credentials for authentications to OAuth serviceserviceLocationInfo - url or host of the service represented by this objectuseProviderTenant - for applications that other tenants can subscribe to, this flag controls whether to always use the
service with the credentials of the provider tenant.@Nonnull public static ScpCfService of(@Nonnull ScpCfServiceDesignator designator, @Nonnull String authUrlJsonPath, @Nonnull String clientIdJsonPath, @Nonnull String clientSecretJsonPath, @Nonnull String serviceLocationJsonPath) throws CloudPlatformException
designator - service designator indicatig the service information to useauthUrlJsonPath - path to the OAuth server URL.clientIdJsonPath - path to client idclientSecretJsonPath - path to client secretserviceLocationJsonPath - path to the service's url or host information or similarCloudPlatformException - On problems like the service type not being present in VCAP_SERVICES@Nonnull public static ScpCfService of(@Nonnull String serviceType, @Nullable String servicePlan, @Nonnull String authUrlJsonPath, @Nonnull String clientIdJsonPath, @Nonnull String clientSecretJsonPath, @Nonnull String serviceLocationJsonPath) throws CloudPlatformException
serviceType - classification of servicesservicePlan - optional service plan identifier to distinguish different instances of the same service type.authUrlJsonPath - path to the OAuth server URL.clientIdJsonPath - path to client idclientSecretJsonPath - path to client secretserviceLocationJsonPath - path to the service's url or host information or similarCloudPlatformException - On problems like the service type not being present in VCAP_SERVICES@Nonnull public static ScpCfService ofMultiTenant(@Nonnull String serviceType, @Nullable String servicePlan, @Nonnull String authUrlJsonPath, @Nonnull String clientIdJsonPath, @Nonnull String clientSecretJsonPath, @Nonnull String serviceLocationJsonPath, boolean useProviderTenant) throws CloudPlatformException
serviceType - classification of servicesservicePlan - optional service plan identifier to distinguish different instances of the same service type.authUrlJsonPath - path to the OAuth server URL.clientIdJsonPath - path to client idclientSecretJsonPath - path to client secretserviceLocationJsonPath - path to the service's url or host information or similaruseProviderTenant - for applications that other tenants can subscribe to, this flag controls whether to always use the
service with the credentials ofMultiTenant the provider tenant.CloudPlatformException - On problems like the service type not being present in VCAP_SERVICES@Nonnull public static ScpCfService ofMultiTenant(@Nonnull ScpCfServiceDesignator designator, @Nonnull String authUrlJsonPath, @Nonnull String clientIdJsonPath, @Nonnull String clientSecretJsonPath, @Nonnull String serviceLocationJsonPath, boolean useProviderTenant) throws CloudPlatformException
designator - service designator indicatig the service information to useauthUrlJsonPath - path to the OAuth server URL.clientIdJsonPath - path to client idclientSecretJsonPath - path to client secretserviceLocationJsonPath - path to the service's url or host information or similaruseProviderTenant - for applications that other tenants can subscribe to, this flag controls whether to always use the
service with the credentials ofMultiTenant the provider tenant.CloudPlatformException - On problems like the service type not being present in VCAP_SERVICES@Nonnull public ScpCfServiceInfo getServiceInfo()
@Nullable public String getServiceLocationInfo()
@Nonnull public URI getAuthUri()
@Nonnull public BasicCredentials getClientCredentials()
@Nonnull public org.apache.http.HttpRequest addBearerTokenHeader(@Nonnull org.apache.http.HttpRequest request) throws com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequestFailedException, com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequestDeniedException
request - to add authentication token to.TokenRequestFailedException - if a technical problem made the request failTokenRequestDeniedException - if the authentication or authorization was not successfulCopyright © 2018 SAP SE. All rights reserved.