File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
main/java/com/sap/ai/sdk/core
test/java/com/sap/ai/sdk/core Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,11 @@ static ServiceBinding createServiceBinding(@Nonnull final String serviceKey)
8181 new AiCoreCredentialsInvalidException ("Missing clientid in service key" ));
8282 }
8383
84+ if (credentials .get ("clientsecret" ) != null && credentials .get ("credentials-type" ) == null ) {
85+ // add missing "credential-type: binding-secret"
86+ credentials .put ("credential-type" , "binding-secret" );
87+ }
88+
8489 return new DefaultServiceBindingBuilder ()
8590 .withServiceIdentifier (ServiceIdentifier .AI_CORE )
8691 .withCredentials (credentials )
Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ void testGetDestinationFromBinding() {
3030 var binding = AiCoreServiceKeyAccessor .createServiceBinding (serviceKey );
3131 var resolver = new DestinationResolver (() -> List .of (binding ));
3232 var result = resolver .getDestination ();
33+ assertThat (binding .getCredentials ().containsKey ("credential-type" ))
34+ .describedAs ("The missing 'credential-type' should have automatically been added" )
35+ .isTrue ();
3336 assertThat (result .getUri ())
3437 .describedAs ("The destination should already contain the /v2 base path" )
3538 .hasToString ("https://api.ai.core/v2/" );
You can’t perform that action at this time.
0 commit comments