@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,
ClientCredentials clientCredentials,
String serviceLocationInfo)
Constructor open for extension.
|
ScpCfService(ScpCfServiceInfo serviceInfo,
URI authUri,
ClientCredentials 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.
|
ClientCredentials |
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 ClientCredentials 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 ClientCredentials 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, ScpCfServiceCreationFailedException
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.ScpCfServiceCreationFailedException
- If the service creation is otherwise incomplete or incorrect.@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, ScpCfServiceCreationFailedException
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.ScpCfServiceCreationFailedException
- If the service creation is otherwise incomplete or incorrect.@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, ScpCfServiceCreationFailedException
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.ScpCfServiceCreationFailedException
- If the service creation is otherwise incomplete or incorrect.@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 and if the service information
is otherwise incomplete or incorrect.@Nonnull public ScpCfServiceInfo getServiceInfo()
@Nullable public String getServiceLocationInfo()
@Nonnull public URI getAuthUri()
@Nonnull public ClientCredentials getClientCredentials()
@Nonnull public org.apache.http.HttpRequest addBearerTokenHeader(@Nonnull org.apache.http.HttpRequest request) throws ScpCfServiceAuthorizationFailedException
request
- to add authentication token to.ScpCfServiceAuthorizationFailedException
- if the request was forbidden or failedCopyright © 2020 SAP SE. All rights reserved.