-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(credentials): implement matchExpression-based credentials #1000
feat(credentials): implement matchExpression-based credentials #1000
Conversation
0cabc68
to
1e15090
Compare
dea8979
to
acfc209
Compare
acfc209
to
73d2f3b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well
66b0050
to
e22452b
Compare
Actually, hold on. I'll add unit tests for the CredentialsManager. It probably should have had them before and it certainly should now. |
Not done adding tests yet, just added basic tests for the new migration function so far. I'll add some more tomorrow. |
0061b21
to
f635baa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't reviewed the tests yet but the implementation changes look good. However, since the credentials-related notifications have been changed to accommodate the match expression change, the StoreJmxCredentials
component (on -web
) no longer updates the table state properly when credentials are added or deleted.
Yea, I'll fix that with TODO 2 listed in the PR body. |
f635baa
to
3d7ef72
Compare
Filing the |
Backend looks good, I'm assuming you'll merge this once the web client gets updated |
13ee3db
to
16272a1
Compare
|
16272a1
to
3169609
Compare
This PR/issue depends on:
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, looks like the web-client submodule hasn't been updated with the frontend changes (I don't see it in the changed files).
It isn't listed as a commit in this PR since I rebased on top, but the latest frontend change in the submodule is already in |
Oh that makes sense then, cool. |
No more manually updating the submodule :-) |
Related to #895
Depends on cryostatio/cryostat-web#475
This PR enhances the existing CredentialsManager by replacing the
targetId
field of stored credentials with amatchExpression
. This uses the same expression evaluation internal infrastructure already in place for Automated Rules, so the syntax and behaviour is exactly the same. There is a migration function that checks all stored credentials already on disk and checks if they have thetargetId
field. If they do not then they are skipped over, since they are either invalid files or conform to the new format already.is migrated by applying a simple transformation to:
This allows the new expression-based system to migrate existing credentials while maintaining the same semantics, and also allows the old credentials API endpoints to continue working with the same behaviour.
Still TODO in follow-up PRs:
matchExpression
, not only the backward-compatibletarget.connectUrl == "foo"
styleUse the new[Story] Enhance JMX Credentials UI for matchExpressions cryostat-web#465CredentialsGetHandler
on the frontend to enhance the Security view to better reflect these expression-based credentialsSince it is now possible for one set of credentials to match multiple targets, the
AbstractAuthenticatedRequestHandler
no longer deletes credentials if they are used for a JMX connection and the connection fails - since the credentials may apply to multiple targets, they may be valid for other targets than the one that was just checked.It is also possible that one target may be matched by multiple sets of credentials. There is no protection against this case, so it would simply be considered a user configuration error. If this occurs then the
credentialsManager
will simply provide the "first" matching set of credentials for a given target when requested. The ordering of credentials is intentionally undefined at this time. Multiple credentials for a given target is not an expected valid configuration and so no scheme of trying each of them in order is attempted, or any other more complex behaviours.