|
41 | 41 |
|
42 | 42 | import com.sap.cloud.environment.servicebinding.api.ServiceBinding;
|
43 | 43 | import com.sap.cloud.environment.servicebinding.api.ServiceIdentifier;
|
| 44 | +import com.sap.cloud.environment.servicebinding.api.exception.ServiceBindingAccessException; |
44 | 45 | import com.sap.cloud.sdk.cloudplatform.connectivity.BtpServiceOptions.BusinessLoggingOptions;
|
45 | 46 | import com.sap.cloud.sdk.cloudplatform.connectivity.BtpServiceOptions.BusinessRulesOptions;
|
46 | 47 | import com.sap.cloud.sdk.cloudplatform.connectivity.BtpServiceOptions.WorkflowOptions;
|
47 | 48 | import com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException;
|
| 49 | +import com.sap.cloud.sdk.cloudplatform.exception.CloudPlatformException; |
48 | 50 | import com.sap.cloud.sdk.cloudplatform.tenant.DefaultTenant;
|
49 | 51 | import com.sap.cloud.sdk.cloudplatform.tenant.TenantAccessor;
|
50 | 52 |
|
@@ -268,6 +270,7 @@ void testAiCore()
|
268 | 270 |
|
269 | 271 | final OAuth2PropertySupplier sut = AI_CORE.resolve(options);
|
270 | 272 |
|
| 273 | + assertThat(sut).isNotNull(); |
271 | 274 | assertThat(sut.getServiceUri())
|
272 | 275 | .isEqualTo(URI.create("https://api.ai.internalprod.eu-central-1.aws.ml.hana.ondemand.com"));
|
273 | 276 | assertThat(sut.getClientIdentity().getId()).isEqualTo("client-id");
|
@@ -551,6 +554,30 @@ void testMutualTlsCanBeCombinedWithTokenRetrievalOptions()
|
551 | 554 | assertThat(tokenRetrievalOptions.getAdditionalTokenRetrievalParameters()).isNotEmpty();
|
552 | 555 | }
|
553 | 556 |
|
| 557 | + @Test |
| 558 | + @DisplayName( "Test the credential type X509_ATTESTED" ) |
| 559 | + void testMutualTlsWithZeroTrustIdentityService() |
| 560 | + { |
| 561 | + final ServiceBinding binding = |
| 562 | + bindingWithCredentials( |
| 563 | + ServiceIdentifier.IDENTITY_AUTHENTICATION, |
| 564 | + entry("app_tid", PROVIDER_TENANT_ID), |
| 565 | + entry("url", PROVIDER_URL), |
| 566 | + entry("credential-type", "X509_ATTESTED"), |
| 567 | + entry("clientid", "ias-client-id")); |
| 568 | + |
| 569 | + final ServiceBindingDestinationOptions options = |
| 570 | + ServiceBindingDestinationOptions.forService(binding).build(); |
| 571 | + |
| 572 | + final OAuth2PropertySupplier sut = IDENTITY_AUTHENTICATION.resolve(options); |
| 573 | + assertThat(sut).isNotNull(); |
| 574 | + |
| 575 | + assertThatThrownBy(sut::getClientIdentity) |
| 576 | + .isInstanceOf(CloudPlatformException.class) |
| 577 | + .describedAs("We are not mocking the ZTIS service here so this should fail") |
| 578 | + .hasCauseInstanceOf(ServiceBindingAccessException.class); |
| 579 | + } |
| 580 | + |
554 | 581 | @Test
|
555 | 582 | void testMutuallyExclusiveOptions()
|
556 | 583 | {
|
|
0 commit comments