Skip to content

Commit 624b943

Browse files
Johannes-SchneiderJohannes SchneiderCharlesDuboisSAP
authored
chore: Use ServiceIdentifier Constants from the Service Binding Library (#367)
Co-authored-by: Johannes Schneider <[email protected]> Co-authored-by: CharlesDuboisSAP <[email protected]> Co-authored-by: Charles Dubois <[email protected]>
1 parent e500da4 commit 624b943

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,17 @@
3535
class BtpServicePropertySuppliers
3636
{
3737
static final OAuth2PropertySupplierResolver XSUAA =
38-
OAuth2PropertySupplierResolver.forServiceIdentifier(ServiceIdentifier.of("xsuaa"), Xsuaa::new);
38+
OAuth2PropertySupplierResolver.forServiceIdentifier(ServiceIdentifier.XSUAA, Xsuaa::new);
3939

4040
static final OAuth2PropertySupplierResolver DESTINATION =
4141
OAuth2PropertySupplierResolver.forServiceIdentifier(ServiceIdentifier.DESTINATION, Destination::new);
4242

4343
static final OAuth2PropertySupplierResolver CONNECTIVITY =
4444
OAuth2PropertySupplierResolver.forServiceIdentifier(ServiceIdentifier.CONNECTIVITY, ConnectivityProxy::new);
4545

46-
/**
47-
* {@link ServiceIdentifier#IDENTITY_AUTHENTICATION} referenced indirectly for backwards compatibility.
48-
*/
4946
static final OAuth2PropertySupplierResolver IDENTITY_AUTHENTICATION =
5047
OAuth2PropertySupplierResolver
51-
.forServiceIdentifier(ServiceIdentifier.of("identity"), IdentityAuthentication::new);
48+
.forServiceIdentifier(ServiceIdentifier.IDENTITY_AUTHENTICATION, IdentityAuthentication::new);
5249

5350
static final OAuth2PropertySupplierResolver WORKFLOW =
5451
OAuth2PropertySupplierResolver
@@ -82,7 +79,7 @@ class BtpServicePropertySuppliers
8279
.withUrlKey(BusinessLoggingOptions.WRITE_API, "writeservice", REMOVE_PATH)
8380
.factory());
8481
static final OAuth2PropertySupplierResolver AI_CORE =
85-
OAuth2PropertySupplierResolver.forServiceIdentifier(ServiceIdentifier.of("aicore"), AiCore::new);
82+
OAuth2PropertySupplierResolver.forServiceIdentifier(ServiceIdentifier.AI_CORE, AiCore::new);
8683

8784
private static final List<OAuth2PropertySupplierResolver> DEFAULT_SERVICE_RESOLVERS = new ArrayList<>();
8885

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

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

107107
final ServiceBindingDestinationOptions.Builder optionsBuilder;
108108
try {
109-
optionsBuilder = ServiceBindingDestinationOptions.forService(ServiceIdentifier.of("identity"));
109+
optionsBuilder = ServiceBindingDestinationOptions.forService(ServiceIdentifier.IDENTITY_AUTHENTICATION);
110110
}
111111
catch( final DestinationAccessException e ) {
112112
return Try.failure(new DestinationAccessException(preparedMessage, e));

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

+1-6
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,6 @@ static class Builder
314314
{
315315
private static final String XSUAA_TOKEN_PATH = "/oauth/token";
316316

317-
/**
318-
* {@link ServiceIdentifier#IDENTITY_AUTHENTICATION} referenced indirectly for backwards compatibility.
319-
*/
320-
private static final ServiceIdentifier IDENTITY_AUTHENTICATION = ServiceIdentifier.of("identity");
321-
322317
private URI tokenUri;
323318
private ClientIdentity identity;
324319
private OnBehalfOf onBehalfOf = OnBehalfOf.TECHNICAL_USER_CURRENT_TENANT;
@@ -371,7 +366,7 @@ Builder withTenantPropagationStrategy( @Nonnull final TenantPropagationStrategy
371366
Builder withTenantPropagationStrategyFrom( @Nullable final ServiceIdentifier serviceIdentifier )
372367
{
373368
final TenantPropagationStrategy tenantPropagationStrategy;
374-
if( IDENTITY_AUTHENTICATION.equals(serviceIdentifier) ) {
369+
if( ServiceIdentifier.IDENTITY_AUTHENTICATION.equals(serviceIdentifier) ) {
375370
tenantPropagationStrategy = TenantPropagationStrategy.TENANT_SUBDOMAIN;
376371
} else {
377372
tenantPropagationStrategy = TenantPropagationStrategy.ZID_HEADER;

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ class XsuaaTest
108108
private static final String PROVIDER_CERT_URL = "https://provider.cert.xsuaa.domain";
109109
private static final ServiceBinding INSTANCE_SECRET_BINDING =
110110
bindingWithCredentials(
111-
ServiceIdentifier.of("xsuaa"),
111+
ServiceIdentifier.XSUAA,
112112
entry("credential-type", "instance-secret"),
113113
entry("clientid", "client-id"),
114114
entry("clientsecret", "client-secret"),
115115
entry("url", PROVIDER_URL));
116116
private static final ServiceBinding X509_BINDING =
117117
bindingWithCredentials(
118-
ServiceIdentifier.of("xsuaa"),
118+
ServiceIdentifier.XSUAA,
119119
entry("credential-type", "x509_generated"),
120120
entry("clientid", "client-id"),
121121
entry("key", "key"),
@@ -360,7 +360,7 @@ class AiCoreTest
360360
{
361361
final ServiceBinding binding =
362362
bindingWithCredentials(
363-
ServiceIdentifier.of("aicore"),
363+
ServiceIdentifier.AI_CORE,
364364
entry("serviceurls.AI_API_URL", "https://api.ai.internalprod.eu-central-1.aws.ml.hana.ondemand.com"),
365365
entry("clientid", "client-id"),
366366
entry("clientsecret", "client-secret"),

release_notes.md

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
### 🔧 Compatibility Notes
1010

11+
- Minimum required versions:
12+
- SAP BTP Security Services Integration Libraries `com.sap.cloud.security` 3.4.3
13+
- CAP `com.sap.cds` 2.9.3
14+
- SAP Java Buildpack `com.sap.cloud.sjb` 2.10.0
1115
- Using IAS requires XSUAA version to be minimum `3.4.0`.
1216

1317
### ✨ New Functionality

0 commit comments

Comments
 (0)