Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use ServiceIdentifier Constants from the Service Binding Library #367

Merged
merged 9 commits into from
Sep 10, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,17 @@
class BtpServicePropertySuppliers
{
static final OAuth2PropertySupplierResolver XSUAA =
OAuth2PropertySupplierResolver.forServiceIdentifier(ServiceIdentifier.of("xsuaa"), Xsuaa::new);
OAuth2PropertySupplierResolver.forServiceIdentifier(ServiceIdentifier.XSUAA, Xsuaa::new);

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

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

/**
* {@link ServiceIdentifier#IDENTITY_AUTHENTICATION} referenced indirectly for backwards compatibility.
*/
static final OAuth2PropertySupplierResolver IDENTITY_AUTHENTICATION =
OAuth2PropertySupplierResolver
.forServiceIdentifier(ServiceIdentifier.of("identity"), IdentityAuthentication::new);
.forServiceIdentifier(ServiceIdentifier.IDENTITY_AUTHENTICATION, IdentityAuthentication::new);

static final OAuth2PropertySupplierResolver WORKFLOW =
OAuth2PropertySupplierResolver
Expand Down Expand Up @@ -82,7 +79,7 @@ class BtpServicePropertySuppliers
.withUrlKey(BusinessLoggingOptions.WRITE_API, "writeservice", REMOVE_PATH)
.factory());
static final OAuth2PropertySupplierResolver AI_CORE =
OAuth2PropertySupplierResolver.forServiceIdentifier(ServiceIdentifier.of("aicore"), AiCore::new);
OAuth2PropertySupplierResolver.forServiceIdentifier(ServiceIdentifier.AI_CORE, AiCore::new);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public Try<HttpDestination> tryGetDestination( @Nonnull final ServiceBindingDest

final ServiceBindingDestinationOptions.Builder optionsBuilder;
try {
optionsBuilder = ServiceBindingDestinationOptions.forService(ServiceIdentifier.of("identity"));
optionsBuilder = ServiceBindingDestinationOptions.forService(ServiceIdentifier.IDENTITY_AUTHENTICATION);
}
catch( final DestinationAccessException e ) {
return Try.failure(new DestinationAccessException(preparedMessage, e));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,6 @@ static class Builder
{
private static final String XSUAA_TOKEN_PATH = "/oauth/token";

/**
* {@link ServiceIdentifier#IDENTITY_AUTHENTICATION} referenced indirectly for backwards compatibility.
*/
private static final ServiceIdentifier IDENTITY_AUTHENTICATION = ServiceIdentifier.of("identity");

private URI tokenUri;
private ClientIdentity identity;
private OnBehalfOf onBehalfOf = OnBehalfOf.TECHNICAL_USER_CURRENT_TENANT;
Expand Down Expand Up @@ -371,7 +366,7 @@ Builder withTenantPropagationStrategy( @Nonnull final TenantPropagationStrategy
Builder withTenantPropagationStrategyFrom( @Nullable final ServiceIdentifier serviceIdentifier )
{
final TenantPropagationStrategy tenantPropagationStrategy;
if( IDENTITY_AUTHENTICATION.equals(serviceIdentifier) ) {
if( ServiceIdentifier.IDENTITY_AUTHENTICATION.equals(serviceIdentifier) ) {
tenantPropagationStrategy = TenantPropagationStrategy.TENANT_SUBDOMAIN;
} else {
tenantPropagationStrategy = TenantPropagationStrategy.ZID_HEADER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ class XsuaaTest
private static final String PROVIDER_CERT_URL = "https://provider.cert.xsuaa.domain";
private static final ServiceBinding INSTANCE_SECRET_BINDING =
bindingWithCredentials(
ServiceIdentifier.of("xsuaa"),
ServiceIdentifier.XSUAA,
entry("credential-type", "instance-secret"),
entry("clientid", "client-id"),
entry("clientsecret", "client-secret"),
entry("url", PROVIDER_URL));
private static final ServiceBinding X509_BINDING =
bindingWithCredentials(
ServiceIdentifier.of("xsuaa"),
ServiceIdentifier.XSUAA,
entry("credential-type", "x509_generated"),
entry("clientid", "client-id"),
entry("key", "key"),
Expand Down Expand Up @@ -360,7 +360,7 @@ class AiCoreTest
{
final ServiceBinding binding =
bindingWithCredentials(
ServiceIdentifier.of("aicore"),
ServiceIdentifier.AI_CORE,
entry("serviceurls.AI_API_URL", "https://api.ai.internalprod.eu-central-1.aws.ml.hana.ondemand.com"),
entry("clientid", "client-id"),
entry("clientsecret", "client-secret"),
Expand Down
4 changes: 4 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

### 🔧 Compatibility Notes

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

### ✨ New Functionality
Expand Down
Loading