Skip to content

Refresh Swagger authentication before API requests - #1857

Draft
krowvin wants to merge 1 commit into
developfrom
feature/swagger-auth-refresh
Draft

Refresh Swagger authentication before API requests#1857
krowvin wants to merge 1 commit into
developfrom
feature/swagger-auth-refresh

Conversation

@krowvin

@krowvin krowvin commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Important

Merge and release Groundwork Water PR #309 first. Before merging this PR, update @usace-watermanagement/groundwork-water in cda-gui/package.json and cda-gui/package-lock.json to the actual published version containing getValidToken, then rerun the validation below.

Summary

  • Refresh the Groundwork-managed token immediately before each Swagger API request.
  • Make Groundwork the single owner of OIDC and AAA authentication state.
  • Remove Swagger's duplicate OIDC/AAA authorization controls while preserving API-key authorization.
  • Remove the confusing detached Reauthenticate action.
  • Retain a backward-compatible refresh fallback until this PR is updated to the newly published Groundwork version.

Why

CDA instantiates the Groundwork auth method directly rather than through AuthProvider, so Groundwork's polling refresh was not running. Swagger's request interceptor could therefore read a stale token. Swagger UI and Groundwork also maintained parallel OIDC state, which exposed authentication controls disconnected from one another.

Related Issue

N/A

Validation

  • CDA GUI ESLint passed.
  • CDA GUI production build passed against the locally linked Groundwork change.
  • Real local CDA/Keycloak integration using the configured 300-second access-token lifespan:
    • Initial secured Swagger request returned HTTP 200.
    • After more than six minutes idle, another Execute refreshed authentication and returned HTTP 200 without reauthentication.
    • No browser errors occurred.

Checklist

Signed-off-by: Charles Graham, SWT <charles.r.graham@usace.army.mil>
@krowvin
krowvin requested a review from MikeNeilson July 31, 2026 15:00
@krowvin

krowvin commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author
image

Initially i had left all parts of the locks in, but this is a bit of both worlds. You can use the API key still via the authorization otherwise the GWW auth methods are used.

Prior to this PR you could authenticate via the authenticate button and that was a separate swagger login to the groundwork water authmethod.

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.

1 participant