gabriel-farache commented on code in PR #3928: URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3928#discussion_r2174719953
########## quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/TokenExchangeIT.java: ########## @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.kogito.quarkus.workflows; + +import java.util.HashMap; +import java.util.Map; + +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusIntegrationTest; +import io.restassured.path.json.JsonPath; + +import jakarta.ws.rs.core.HttpHeaders; + +import static org.kie.kogito.quarkus.workflows.ExternalServiceMock.SUCCESSFUL_QUERY; +import static org.kie.kogito.quarkus.workflows.TokenExchangeExternalServicesMock.BASE_AND_PROPAGATED_AUTHORIZATION_TOKEN; +import static org.kie.kogito.test.utils.ProcessInstancesRESTTestUtils.newProcessInstance; + +@QuarkusTestResource(TokenExchangeExternalServicesMock.class) +@QuarkusTestResource(KeycloakServiceMock.class) +@QuarkusIntegrationTest +class TokenExchangeIT { + + @Test + void tokenExchange() { + // start a new process instance by sending the post query and collect the process instance id. + String processInput = buildProcessInput(SUCCESSFUL_QUERY); + Map<String, String> headers = new HashMap<>(); + // prepare the headers to pass to the token_propagation SW. + // service token-propagation-external-service1 and token-propagation-external-service2 will receive the AUTHORIZATION_TOKEN + headers.put(HttpHeaders.AUTHORIZATION, BASE_AND_PROPAGATED_AUTHORIZATION_TOKEN); + + JsonPath jsonPath = newProcessInstance("/token_exchange", processInput, headers); + Assertions.assertThat(jsonPath.getString("id")).isNotBlank(); + } + Review Comment: I tried to run a test without the Authorization header, the exception was there: ``` Caused by: io.quarkus.runtime.configuration.ConfigurationException: An access token is required in the header Authorization (default is Authorization) but none was provided at org.kie.kogito.serverless.workflow.openapi.OpenApiCustomCredentialProvider.getOauth2BearerToken(OpenApiCustomCredentialProvider.java:66) at org.kie.kogito.serverless.workflow.openapi.OpenApiCustomCredentialProvider_ClientProxy.getOauth2BearerToken(Unknown Source) at io.quarkiverse.openapi.generator.oidc.providers.OAuth2AuthenticationProvider.filter(OAuth2AuthenticationProvider.java:48) at io.quarkiverse.openapi.generator.providers.BaseCompositeAuthenticationProvider.filter(BaseCompositeAuthenticationProvider.java:40) at org.acme.externalexchangeservice.api.auth.CompositeAuthenticationProvider.filter(CompositeAuthenticationProvider.java:15) at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.filterRequest(ClientInvocation.java:644) ... 84 more ``` but there is no way to have any feedback from the API: the execution request returns a 201 with the ID but when I try to get the processInstance, I get a 404 as the execution is completed @fjtirado is there a way to get the status of the workflow after the execution was complete? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
