Complete OAuth2 authorization support#1446
Merged
Merged
Conversation
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds broader OAuth2 workflow support and samples, including JWT-based client authentication and token-exchange parameters, and expands request building to carry revocation/introspection endpoint URIs.
Changes:
- Add workflow sample YAMLs for
client_secret_jwt,private_key_jwt, and token exchange grant. - Implement JWT client assertion handling and token-exchange subject/actor parameters in request building.
- Extend OAuth request URI resolution to include revocation/introspection URIs; add JUnit coverage for new samples.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| impl/test/src/test/resources/workflows-samples/oauth2/oAuthPrivateKeyJwtClientCredentialsHttpCall.yaml | Adds sample workflow using private_key_jwt client auth for client credentials. |
| impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostTokenExchangeHttpCall.yaml | Adds sample workflow for token exchange grant with subject/actor tokens. |
| impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretJwtClientCredentialsHttpCall.yaml | Adds sample workflow using client_secret_jwt client auth for client credentials. |
| impl/test/src/test/java/io/serverlessworkflow/impl/test/OAuthHTTPWorkflowDefinitionTest.java | Adds tests validating form-encoded token request bodies for JWT client auth and token exchange. |
| impl/core/src/main/java/io/serverlessworkflow/impl/auth/OAuthRequestBuilder.java | Adds revocation/introspection URI resolution alongside token URI. |
| impl/core/src/main/java/io/serverlessworkflow/impl/auth/JwtClientAssertion.java | Introduces handler that maps provided JWT assertions to RFC7523 form params. |
| impl/core/src/main/java/io/serverlessworkflow/impl/auth/HttpRequestInfoBuilder.java | Extends request info to include revocation/introspection URIs. |
| impl/core/src/main/java/io/serverlessworkflow/impl/auth/HttpRequestInfo.java | Adds revocation/introspection URI fields to the record. |
| impl/core/src/main/java/io/serverlessworkflow/impl/auth/ClientSecretHandler.java | Allows token exchange grant through existing client-secret handlers. |
| impl/core/src/main/java/io/serverlessworkflow/impl/auth/AuthUtils.java | Adds constants for assertion and token-exchange related param names. |
| impl/core/src/main/java/io/serverlessworkflow/impl/auth/AbstractAuthRequestBuilder.java | Implements JWT assertion auth method selection + subject/actor param forwarding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+67
to
+69
| private static String endpointPath(String path, String defaultPath) { | ||
| return path != null ? path.replaceAll("^/", "") : defaultPath; | ||
| } |
fjtirado
reviewed
Jun 10, 2026
fjtirado
reviewed
Jun 10, 2026
Comment on lines
+69
to
+80
| void accept(Map<String, Object> secret) { | ||
| Map<String, Object> client = asClient(secret); | ||
| if (client == null || client.get(ASSERTION) == null) { | ||
| throw new IllegalArgumentException( | ||
| "A client assertion must be provided for JWT client authentication"); | ||
| } | ||
| if (PASSWORD.value().equals(secret.get(GRANT))) { | ||
| password(secret); | ||
| } else { | ||
| clientCredentials(secret); | ||
| } | ||
| } |
Comment on lines
+67
to
+69
| private static String endpointPath(String path, String defaultPath) { | ||
| return path != null ? path.replaceAll("^/", "") : defaultPath; | ||
| } |
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
fjtirado
reviewed
Jun 11, 2026
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
fjtirado
reviewed
Jun 12, 2026
fjtirado
approved these changes
Jun 12, 2026
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
fjtirado
reviewed
Jun 15, 2026
fjtirado
approved these changes
Jun 15, 2026
Collaborator
|
@mcruzdev There are a couple of nitpick but I think we are ready to go |
fjtirado
reviewed
Jun 15, 2026
fjtirado
reviewed
Jun 15, 2026
fjtirado
left a comment
Collaborator
There was a problem hiding this comment.
On a second look, there are still some leftover from previous attemps, please take a look
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Comment on lines
90
to
91
| Client client = HttpClientResolver.client(workflow, task); | ||
| WebTarget target = client.target(requestInfo.uri().apply(workflow, task, model)); |
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Many thanks for submitting your Pull Request ❤️!
What this PR does / why we need it:
private_key_jwtandclient_secret_jwt.Special notes for reviewers:
Additional information (if needed):
Closes #1003