-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
UI/OIDC auth bug for cloud ui HCP namespace flag #16886
UI/OIDC auth bug for cloud ui HCP namespace flag #16886
Conversation
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.
Great work, thank you! Just a couple small notes
Hey folks, if this PR doesn't merge today, could someone please re-milestone it for 1.10.7, as it will miss the freeze? |
assert.propContains( | ||
this.windowStub.lastCall.args[0], | ||
{ | ||
code: undefined, |
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 think leaving these as undefined might lead to some weird behavior on the postMessage
receiver side, could we default to empty string if these don't exist? A bit more verbose but something like:
let queryParams = { source, path: path || '', code: code || '', state: state || '' };
Maybe as a follow-on, because I think that's not likely a scenario we'll get into in real life
// only replace namespace param from cluster if state has a namespace | ||
if (state?.includes(',ns=')) { | ||
[state, namespace] = state.split(',ns='); | ||
} | ||
path = window.decodeURIComponent(path); | ||
const source = 'oidc-callback'; // required by event listener in auth-jwt component | ||
let queryParams = { source, namespace, path, code, state }; |
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.
One more cleanup task (follow-on) is, if namespace doesn't exist don't include it. So remove from queryParams here and then below do
if (namespace) queryParams.namespace = namespace
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.
Thank you!
Fixes the
afterModel()
hook so that it can handle both when a namespace comes in as a param from the cluster:namespaceQueryParam = 'admin'
and when it's attached to the state from the route params:state="st_z6y8L12PndJ33FmW1Ls2,ns=admin"
The namespace passed via state will take precedence