Skip to content

Allow for case of OpenID provider not yet being ready. - #1859

Merged
MikeNeilson merged 2 commits into
developfrom
bugfix/1858-auth-openapi-refresh
Aug 7, 2026
Merged

Allow for case of OpenID provider not yet being ready.#1859
MikeNeilson merged 2 commits into
developfrom
bugfix/1858-auth-openapi-refresh

Conversation

@MikeNeilson

Copy link
Copy Markdown
Contributor

Summary

Attempts to initially query the provider and if it's not available try every 5 minutes until it is. Or never if now wellKnown URL was provided.

Additionally, added mechanism to surpress specific IdentityProviders in certain envrionments.

Modified docker compose to simulate the initial missing keycloak configuration and allow better remote development by removing the need for the alt well known setup.

Related Issue

Closes #1858

Validation

Manually - confirmed with the docker compose that hte initial load shows now OIDC provider, 5 minutes later there is a provider. Additonally the CWMSAAA reference is not present in the compose.

Not really a good way to setup a test of this; perhaps with a job that makes use of the docker-compose file similar to this https://github.com/opendcs/opendcs/blob/67d6d9e655132732796b006e94dc11fb35fe5dd9/.github/workflows/container-tests.yml#L17.

Checklist

  • AI tools used

@MikeNeilson
MikeNeilson force-pushed the bugfix/1858-auth-openapi-refresh branch 2 times, most recently from 2b5009b to aaa35e4 Compare August 7, 2026 13:57
MikeNeilson pushed a commit that referenced this pull request Aug 7, 2026
## Summary

Follow-up hardening for #1859's OpenID discovery retry and local Compose
setup.

## Changes and rationale

- Treat OpenID as unable to authenticate until its configuration is
ready, preventing bearer requests from dereferencing a missing parser
during the retry window.
- Skip retry scheduling when no well-known URL is configured and stop
scheduling after successful initialization, avoiding rejected executor
work and unnecessary polling.
- Pass `APP_PORT` into the data-api container, keeping its local
authentication proxy aligned with the discovery URL and Keycloak when a
nondefault port is used.
- Add regression coverage for the intentionally disabled no-URL
configuration.

Per review feedback, this follow-up no longer changes
`Authenticator.java`.

## Validation

- `./gradlew :cwms-data-api:test --tests '*OpenIDConfigTest'
:cwms-data-api:checkstyleMain :cwms-data-api:checkstyleTest`
- `docker compose config` with `APP_PORT=9090`
- `git diff --check`

The focused test and Checkstyle tasks pass. Checkstyle reports the
repository's existing warning-level violations.

---------

Signed-off-by: Charles Graham, SWT <charles.r.graham@usace.army.mil>
MikeNeilson and others added 2 commits August 7, 2026 09:16
Attempts to initially query the provider and if it's not available try every
5 minutes until it is. Or never if now wellKnown URL was provided.

Additionally, added mechanism to surpress specific IdentityProviders in certain
envrionments.

Modified docker compose to simulate the initial missing keycloak configuration
and allow better remote development by removing the need for the alt well known setup.
## Summary

Follow-up hardening for #1859's OpenID discovery retry and local Compose
setup.

## Changes and rationale

- Treat OpenID as unable to authenticate until its configuration is
ready, preventing bearer requests from dereferencing a missing parser
during the retry window.
- Skip retry scheduling when no well-known URL is configured and stop
scheduling after successful initialization, avoiding rejected executor
work and unnecessary polling.
- Pass `APP_PORT` into the data-api container, keeping its local
authentication proxy aligned with the discovery URL and Keycloak when a
nondefault port is used.
- Add regression coverage for the intentionally disabled no-URL
configuration.

Per review feedback, this follow-up no longer changes
`Authenticator.java`.

## Validation

- `./gradlew :cwms-data-api:test --tests '*OpenIDConfigTest'
:cwms-data-api:checkstyleMain :cwms-data-api:checkstyleTest`
- `docker compose config` with `APP_PORT=9090`
- `git diff --check`

The focused test and Checkstyle tasks pass. Checkstyle reports the
repository's existing warning-level violations.

---------

Signed-off-by: Charles Graham, SWT <charles.r.graham@usace.army.mil>
@MikeNeilson
MikeNeilson force-pushed the bugfix/1858-auth-openapi-refresh branch from 305c4cb to 7222991 Compare August 7, 2026 16:16
@MikeNeilson
MikeNeilson merged commit 95a5810 into develop Aug 7, 2026
11 checks passed
@MikeNeilson
MikeNeilson deleted the bugfix/1858-auth-openapi-refresh branch August 7, 2026 17:46
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.

Automatic retry/reload of Authentication options

2 participants