@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.
|
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(String serviceType,
String servicePlan,
String authUrlJsonPath,
String clientIdJsonPath,
String clientSecretJsonPath,
String serviceLocationJsonPath)
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 object@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 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.