Skip to content

Add JWT token refresh to Fusion validation request#6231

Merged
pditommaso merged 4 commits intomasterfrom
license-token-refresh-token
Jun 30, 2025
Merged

Add JWT token refresh to Fusion validation request#6231
pditommaso merged 4 commits intomasterfrom
license-token-refresh-token

Conversation

@pditommaso
Copy link
Member

@pditommaso pditommaso commented Jun 28, 2025

Summary

This PR adds the support for JWT token refresh to the Fusion validation HTTP request.

Detail

This pull request introduces significant changes to the TowerFusionToken class and its corresponding test suite, focusing on improving token management, adding support for token refresh flow, and enhancing test coverage. Key changes include the addition of a refresh token mechanism, modifications to the HTTP client configuration, and new tests to validate the behavior of token refresh and retry logic.

Token Management Enhancements:

  • Added support for refreshToken alongside accessToken to enable token refresh workflows. Updated the constructor to initialize refreshToken using PlatformHelper. ([[1]](https://github.com/nextflow-io/nextflow/pull/6231/files#diff-d32afd5d3bc193f22e71a22cf64193ef5b3ce79652cfb81991c499a049d04a21L83-R88), [[2]](https://github.com/nextflow-io/nextflow/pull/6231/files#diff-d32afd5d3bc193f22e71a22cf64193ef5b3ce79652cfb81991c499a049d04a21R101))
  • Implemented refreshJwtToken0 method to handle token refresh requests and update accessToken and refreshToken based on received cookies. ([plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionToken.groovyR344-R391](https://github.com/nextflow-io/nextflow/pull/6231/files#diff-d32afd5d3bc193f22e71a22cf64193ef5b3ce79652cfb81991c499a049d04a21R344-R391))
  • Modified sendRequest method to retry requests with refreshed tokens upon receiving a 401 Unauthorized response. ([plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionToken.groovyL292-R334](https://github.com/nextflow-io/nextflow/pull/6231/files#diff-d32afd5d3bc193f22e71a22cf64193ef5b3ce79652cfb81991c499a049d04a21L292-R334))

HTTP Client Configuration:

  • Made cookieManager a class-level field to manage cookies across requests. Updated newDefaultHttpClient to use this shared cookieManager. ([[1]](https://github.com/nextflow-io/nextflow/pull/6231/files#diff-d32afd5d3bc193f22e71a22cf64193ef5b3ce79652cfb81991c499a049d04a21R66-R67), [[2]](https://github.com/nextflow-io/nextflow/pull/6231/files#diff-d32afd5d3bc193f22e71a22cf64193ef5b3ce79652cfb81991c499a049d04a21L185-R195))
  • Refactored safeHttpSend into httpSend and safeApply to simplify error handling and improve readability. ([plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionToken.groovyL239-R255](https://github.com/nextflow-io/nextflow/pull/6231/files#diff-d32afd5d3bc193f22e71a22cf64193ef5b3ce79652cfb81991c499a049d04a21L239-R255))

Test Suite Enhancements:

  • Added a new test case to validate the token refresh flow and retry logic when a 401 Unauthorized response is encountered. ([plugins/nf-tower/src/test/io/seqera/tower/plugin/TowerFusionEnvTest.groovyR338-R424](https://github.com/nextflow-io/nextflow/pull/6231/files#diff-1f6c1ec51e8c0824fec6d7c608d21f5465113d7d689d35e2c516c9cb18bae283R338-R424))
  • Improved test coverage by verifying the correct handling of HTTP requests during token refresh and retry scenarios. ([plugins/nf-tower/src/test/io/seqera/tower/plugin/TowerFusionEnvTest.groovyR338-R424](https://github.com/nextflow-io/nextflow/pull/6231/files#diff-1f6c1ec51e8c0824fec6d7c608d21f5465113d7d689d35e2c516c9cb18bae283R338-R424))

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@netlify
Copy link

netlify bot commented Jun 28, 2025

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 631394b
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/68626512ee44ca0008c670dc

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@pditommaso

This comment was marked as outdated.

@pditommaso pditommaso closed this Jun 30, 2025
@pditommaso pditommaso reopened this Jun 30, 2025
@pditommaso pditommaso merged commit 95dfdaf into master Jun 30, 2025
22 checks passed
@pditommaso pditommaso deleted the license-token-refresh-token branch June 30, 2025 13:01
pditommaso added a commit that referenced this pull request Jun 30, 2025
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
pditommaso added a commit that referenced this pull request Jun 30, 2025
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
pditommaso added a commit that referenced this pull request Jun 30, 2025
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
exthnet pushed a commit to exthnet/nextflow_tcs that referenced this pull request Jul 3, 2025
… [ci fast]

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Satoshi OHSHIMA <ohshima@cc.kyushu-u.ac.jp>
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.

2 participants