Skip to content

feat: 79 standard login should be supported#155

Open
krowvin wants to merge 31 commits intomainfrom
79-standard-login-should-be-supported
Open

feat: 79 standard login should be supported#155
krowvin wants to merge 31 commits intomainfrom
79-standard-login-should-be-supported

Conversation

@krowvin
Copy link
Copy Markdown
Collaborator

@krowvin krowvin commented Mar 17, 2026

Drafting this as I work through it for visibility

Created issue with cwms-python here:
HydrologicEngineeringCenter/cwms-python#274

Once that has been merged in, will update this PR to include those changes and make it so this login method can be used for cli commands.

@krowvin krowvin linked an issue Mar 17, 2026 that may be closed by this pull request
@krowvin krowvin changed the title 79 standard login should be supported WIP - 79 standard login should be supported Mar 17, 2026
Copy link
Copy Markdown
Collaborator Author

@krowvin krowvin left a comment

Choose a reason for hiding this comment

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

Few comments I had to the reviewers


- Override the client ID, OIDC base URL, and scopes:

``cwms-cli login --client-id cwms --oidc-base-url https://identity-test.cwbi.us/auth/realms/cwbi/protocol/openid-connect --scope "openid profile"``
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this will publish this and make it static, a thing for maintenance?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

maybe just a very generic placeholder URL? The actual URL for for the login should be derived from the CDA target OpenAPI spec.

@krowvin krowvin requested review from Enovotny and MikeNeilson March 17, 2026 16:08
@krowvin
Copy link
Copy Markdown
Collaborator Author

krowvin commented Mar 17, 2026

Initial PR of these changes requested to @Enovotny and/or @MikeNeilson

Will continue the second half of this PR as it currently only saves the token to disk. Need HydrologicEngineeringCenter/cwms-python#274

to make use of the token that is saved.

@krowvin
Copy link
Copy Markdown
Collaborator Author

krowvin commented Mar 17, 2026

If you would like to test this locally:

pip install --upgrade git+https://github.com/HydrologicEngineeringCenter/cwms-cli.git@79-standard-login-should-be-supported

then

cwms-cli login

Copy link
Copy Markdown

@MikeNeilson MikeNeilson left a comment

Choose a reason for hiding this comment

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

Is this just the ability to login right now? I'm not seeing how it integrates with actually calls to CDA - just want to verify if that is intentional right now.


- Override the client ID, OIDC base URL, and scopes:

``cwms-cli login --client-id cwms --oidc-base-url https://identity-test.cwbi.us/auth/realms/cwbi/protocol/openid-connect --scope "openid profile"``
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

maybe just a very generic placeholder URL? The actual URL for for the login should be derived from the CDA target OpenAPI spec.

@krowvin
Copy link
Copy Markdown
Collaborator Author

krowvin commented Mar 17, 2026

Is this just the ability to login right now?

@MikeNeilson that is correct via #155 (comment)

I have the issue made here and i'm working on PR that for cwms-python. But if this were to change drastically it could change that PR so asking for initial review. Will request again when I mark it as "ready for review".

@krowvin krowvin changed the title WIP - 79 standard login should be supported feat: 79 standard login should be supported Mar 27, 2026
@krowvin
Copy link
Copy Markdown
Collaborator Author

krowvin commented Apr 7, 2026

cwms-cli can consume CDA OpenAPI auth metadata now, but cwmscli/utils/auth.py:126 and cwmscli/utils/auth.py:148 show we currently need recovery logic because the published OpenIDConnect URLs are off. Could we tweak openIdConnectUrl?

Then we could remove the workaround mentioned above

Need to test this more before I mark it ready, submitting here for visibility

@MikeNeilson
Copy link
Copy Markdown

cwms-cli can consume CDA OpenAPI auth metadata now, but cwmscli/utils/auth.py:126 and cwmscli/utils/auth.py:148 show we currently need recovery logic because the published OpenIDConnect URLs are off. Could we tweak openIdConnectUrl?

Then we could remove the workaround mentioned above

Need to test this more before I mark it ready, submitting here for visibility

What's off about the URL? at least dev and test should be using the not identityc version now. Can't remember for prod.

@krowvin
Copy link
Copy Markdown
Collaborator Author

krowvin commented Apr 8, 2026

What's off about the URL?

I was having some trouble getting the URL from the swagger spec, but I submitted a PR that enabled me to do so easier

krowvin added a commit to USACE/cwms-data-api that referenced this pull request Apr 8, 2026
Alters CDA published OpenID Connect metadata and improves local OIDC
test coverage

Changes:

- remove the invalid HTTP auth scheme("openid") from the oIdConnect
security scheme so Swagger publishes a correct oIdConnectUrl
- add a focused test for openID security scheme
- add debug logging for JWT validation failures to expose the underlying
claim/signature issue during local auth setup
- update local compose seed data so m5hectest has TS ID Creator in SWT,
matching the documented/test write-user expectations

Used this in testing 
- HydrologicEngineeringCenter/cwms-cli#155
@krowvin krowvin marked this pull request as ready for review April 8, 2026 15:49
@krowvin krowvin requested a review from MikeNeilson April 8, 2026 15:49
krowvin added 2 commits April 8, 2026 20:12
# Conflicts:
#	docs/cli/blob.rst
#	docs/index.rst
#	tests/commands/test_blob_upload.py
…uld-be-supported

# Conflicts:
#	cwmscli/load/timeseries/timeseries_ids.py
@krowvin
Copy link
Copy Markdown
Collaborator Author

krowvin commented Apr 9, 2026

I tried this on localhost and was able to use cwms-cli login targeting keycloak/cda on localhost using the CDA PR above.

Might take a final peak @MikeNeilson before we merge this in?

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.

Standard "login" should be supported

2 participants