Skip to content

Commit dbfb26c

Browse files
author
Johannes Schneider
committed
chore: use constants provided by the SBL
1 parent e81722a commit dbfb26c

File tree

5 files changed

+6
-11
lines changed

5 files changed

+6
-11
lines changed

cloudplatform/connectivity-oauth/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/BtpServicePropertySuppliers.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class BtpServicePropertySuppliers
4444
*/
4545
static final OAuth2PropertySupplierResolver IDENTITY_AUTHENTICATION =
4646
OAuth2PropertySupplierResolver
47-
.forServiceIdentifier(ServiceIdentifier.of("identity"), IdentityAuthentication::new);
47+
.forServiceIdentifier(ServiceIdentifier.IDENTITY_AUTHENTICATION, IdentityAuthentication::new);
4848

4949
static final OAuth2PropertySupplierResolver WORKFLOW =
5050
OAuth2PropertySupplierResolver
@@ -78,7 +78,7 @@ class BtpServicePropertySuppliers
7878
.withUrlKey(BusinessLoggingOptions.WRITE_API, "writeservice", REMOVE_PATH)
7979
.factory());
8080
static final OAuth2PropertySupplierResolver AI_CORE =
81-
OAuth2PropertySupplierResolver.forServiceIdentifier(ServiceIdentifier.of("aicore"), AiCore::new);
81+
OAuth2PropertySupplierResolver.forServiceIdentifier(ServiceIdentifier.AI_CORE, AiCore::new);
8282

8383
private static final List<OAuth2PropertySupplierResolver> DEFAULT_SERVICE_RESOLVERS = new ArrayList<>();
8484

cloudplatform/connectivity-oauth/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/IdentityAuthenticationServiceBindingDestinationLoader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public Try<HttpDestination> tryGetDestination( @Nonnull final ServiceBindingDest
7676

7777
final ServiceBindingDestinationOptions.Builder optionsBuilder =
7878
ServiceBindingDestinationOptions
79-
.forService(ServiceIdentifier.of("identity"))
79+
.forService(ServiceIdentifier.IDENTITY_AUTHENTICATION)
8080
.onBehalfOf(options.getOnBehalfOf())
8181
.withOption(BtpServiceOptions.IasOptions.withTargetUri(endpoint.uri));
8282

cloudplatform/connectivity-oauth/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/OAuth2Service.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,6 @@ static class Builder
275275
private static final String XSUAA_TOKEN_PATH = "/oauth/token";
276276
private static final Duration DEFAULT_TIME_OUT = Duration.ofSeconds(10);
277277

278-
/**
279-
* {@link ServiceIdentifier#IDENTITY_AUTHENTICATION} referenced indirectly for backwards compatibility.
280-
*/
281-
private static final ServiceIdentifier IDENTITY_AUTHENTICATION = ServiceIdentifier.of("identity");
282-
283278
private URI tokenUri;
284279
private ClientIdentity identity;
285280
private OnBehalfOf onBehalfOf = OnBehalfOf.TECHNICAL_USER_CURRENT_TENANT;
@@ -333,7 +328,7 @@ Builder withTenantPropagationStrategy( @Nonnull final TenantPropagationStrategy
333328
Builder withTenantPropagationStrategyFrom( @Nullable final ServiceIdentifier serviceIdentifier )
334329
{
335330
final TenantPropagationStrategy tenantPropagationStrategy;
336-
if( IDENTITY_AUTHENTICATION.equals(serviceIdentifier) ) {
331+
if( ServiceIdentifier.IDENTITY_AUTHENTICATION.equals(serviceIdentifier) ) {
337332
tenantPropagationStrategy = TenantPropagationStrategy.TENANT_SUBDOMAIN;
338333
} else {
339334
tenantPropagationStrategy = TenantPropagationStrategy.ZID_HEADER;

cloudplatform/connectivity-oauth/src/test/java/com/sap/cloud/sdk/cloudplatform/connectivity/BtpServicePropertySuppliersTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class AiCoreTest
254254
{
255255
final ServiceBinding binding =
256256
bindingWithCredentials(
257-
ServiceIdentifier.of("aicore"),
257+
ServiceIdentifier.AI_CORE,
258258
entry("serviceurls.AI_API_URL", "https://api.ai.internalprod.eu-central-1.aws.ml.hana.ondemand.com"),
259259
entry("clientid", "client-id"),
260260
entry("clientsecret", "client-secret"),

cloudplatform/connectivity-oauth/src/test/java/com/sap/cloud/sdk/cloudplatform/connectivity/IdentityAuthenticationServiceBindingDestinationLoaderTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.sap.cloud.sdk.cloudplatform.connectivity;
22

3+
import static com.sap.cloud.environment.servicebinding.api.ServiceIdentifier.IDENTITY_AUTHENTICATION;
34
import static com.sap.cloud.sdk.cloudplatform.connectivity.BtpServiceOptions.IasOptions.IasCommunicationOptions;
45
import static com.sap.cloud.sdk.cloudplatform.connectivity.BtpServiceOptions.IasOptions.IasTargetUri;
56
import static com.sap.cloud.sdk.cloudplatform.connectivity.BtpServiceOptions.IasOptions.NoTokenForTechnicalProviderUser;
@@ -40,7 +41,6 @@
4041
class IdentityAuthenticationServiceBindingDestinationLoaderTest
4142
{
4243
private static final ServiceIdentifier SERVICE_IDENTIFIER = ServiceIdentifier.of("test-service");
43-
private static final ServiceIdentifier IDENTITY_AUTHENTICATION = ServiceIdentifier.of("identity");
4444
private static final DefaultServiceBinding IDENTITY_BINDING =
4545
DefaultServiceBinding.builder().copy(Map.of()).withServiceIdentifier(IDENTITY_AUTHENTICATION).build();
4646

0 commit comments

Comments
 (0)