Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class TransparentProxyDestination implements HttpDestination
static final String TENANT_SUBDOMAIN_HEADER_KEY = "x-tenant-subdomain";
static final String TENANT_ID_HEADER_KEY = "x-tenant-id";
static final String FRAGMENT_OPTIONAL_HEADER_KEY = "x-fragment-optional";
static final String DESTINATION_LEVEL_HEADER_KEY = "x-destination-level";
static final String FRAGMENT_LEVEL_HEADER_KEY = "x-fragment-level";
static final String TOKEN_SERVICE_TENANT_HEADER_KEY = "x-token-service-tenant";
static final String CLIENT_ASSERTION_HEADER_KEY = "x-client-assertion";
static final String CLIENT_ASSERTION_TYPE_HEADER_KEY = "x-client-assertion-type";
Expand Down Expand Up @@ -661,7 +663,7 @@ protected DynamicBuilder getThis()

/**
* Sets the fragment name for the dynamic destination. See
* https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations
* https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destination
*
* @param fragmentName
* The name of the fragment to use.
Expand All @@ -673,6 +675,34 @@ public DynamicBuilder fragmentName( @Nonnull final String fragmentName )
return header(new Header(FRAGMENT_NAME_HEADER_KEY, fragmentName));
}

/**
* Sets the destination level for the dynamic destination. See
* https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any docs here about the level?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version of the documentation with the dynamic lookup of destinations is not yet applied to the public documentation since this feature is not released in the transparent proxy yet. You can see the corresponding page in the internal documentation: https://wiki.one.int.sap/wiki/pages/viewpage.action?pageId=3811223491

However, I have used the public documentation URL since the change will be applied there with the next transparent proxy release.

*
* @param destinationLevel
* The level of the destination to use.
* @return This builder instance for method chaining.
*/
@Nonnull
public DynamicBuilder destinationLevel( @Nonnull final DestinationServiceOptionsAugmenter.CrossLevelScope destinationLevel )
{
return header(new Header(DESTINATION_LEVEL_HEADER_KEY, destinationLevel.toString()));
}

/**
* Sets the fragment level for the dynamic destination. See
* https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations
*
* @param fragmentLevel
* The level of the fragment to use.
* @return This builder instance for method chaining.
*/
@Nonnull
public DynamicBuilder fragmentLevel( @Nonnull final DestinationServiceOptionsAugmenter.CrossLevelScope fragmentLevel )
{
return header(new Header(FRAGMENT_LEVEL_HEADER_KEY, fragmentLevel.toString()));
}

/**
* Sets the fragment optional flag for the dynamic destination. See
* https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class TransparentProxyDestinationTest
private static final String TEST_TENANT_SUBDOMAIN = "subdomainValue";
private static final String TEST_TENANT_ID = "tenantIdValue";
private static final String TEST_AUTHORIZATION_HEADER = "dummy-jwt-token";
private static final String SUBACCOUNT_LEVEL = "subaccount";
private static final String PROVIDER_SUBACCOUNT_LEVEL = "provider_subaccount";

@Test
void testGetDelegationDestination()
Expand Down Expand Up @@ -75,14 +77,18 @@ void testDynamicDestinationHeaders()
final TransparentProxyDestination destination =
TransparentProxyDestination
.dynamicDestination(TEST_DEST_NAME, VALID_URI.toString())
.destinationLevel(SUBACCOUNT_LEVEL)
.fragmentName("fragName")
.fragmentLevel(PROVIDER_SUBACCOUNT_LEVEL)
.fragmentOptional(true)
.build();

assertThat(destination.getHeaders(VALID_URI))
.contains(
new Header(TransparentProxyDestination.DESTINATION_NAME_HEADER_KEY, TEST_DEST_NAME),
new Header(TransparentProxyDestination.DESTINATION_LEVEL_HEADER_KEY, SUBACCOUNT_LEVEL),
new Header(TransparentProxyDestination.FRAGMENT_NAME_HEADER_KEY, "fragName"),
new Header(TransparentProxyDestination.FRAGMENT_LEVEL_HEADER_KEY, PROVIDER_SUBACCOUNT_LEVEL),
new Header(TransparentProxyDestination.FRAGMENT_OPTIONAL_HEADER_KEY, "true"));
}

Expand Down