Skip to content

Complete OAuth2 authorization support#1446

Merged
fjtirado merged 10 commits into
serverlessworkflow:mainfrom
mcruzdev:issue-1003
Jun 16, 2026
Merged

Complete OAuth2 authorization support#1446
fjtirado merged 10 commits into
serverlessworkflow:mainfrom
mcruzdev:issue-1003

Conversation

@mcruzdev

@mcruzdev mcruzdev commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Many thanks for submitting your Pull Request ❤️!

What this PR does / why we need it:

  • Adds support to private_key_jwt and client_secret_jwt.

Special notes for reviewers:

Additional information (if needed):

Closes #1003

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Copilot AI review requested due to automatic review settings June 9, 2026 17:36
@mcruzdev mcruzdev requested a review from fjtirado as a code owner June 9, 2026 17:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Duplicted, but valid

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/auth/OAuthRequestBuilder.java Outdated
Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/auth/OAuthRequestBuilder.java Outdated
Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/auth/HttpRequestInfo.java Outdated
Copilot AI review requested due to automatic review settings June 10, 2026 14:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

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);
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mcruzdev I think that one is valid too

Comment on lines +67 to +69
private static String endpointPath(String path, String defaultPath) {
return path != null ? path.replaceAll("^/", "") : defaultPath;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mcruzdev That one is valid, please fix

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/auth/OAuthRequestBuilder.java Outdated
mcruzdev added 4 commits June 10, 2026 19:34
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>
Copilot AI review requested due to automatic review settings June 10, 2026 23:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/auth/OAuthRequestBuilder.java Outdated
Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/auth/AccessTokenProvider.java Outdated
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Comment thread .gitignore
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Copilot AI review requested due to automatic review settings June 12, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 23 comments.

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/auth/OAuthRequestBuilder.java Outdated
@fjtirado

Copy link
Copy Markdown
Collaborator

@mcruzdev There are a couple of nitpick but I think we are ready to go

@fjtirado fjtirado left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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>
Copilot AI review requested due to automatic review settings June 16, 2026 02:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.

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>
Copilot AI review requested due to automatic review settings June 16, 2026 03:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.

@fjtirado fjtirado merged commit de5723c into serverlessworkflow:main Jun 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Complete Oauth 2 authorization support

3 participants