-
Notifications
You must be signed in to change notification settings - Fork 32
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
Get real username when in cluster #84
Get real username when in cluster #84
Conversation
eaa6be3
to
bb5bb33
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.
We could update type KubeStatus
to:
export type KubeStatus = {
currentContext: string;
currentUser: User;
namespace: string;
userName?: string;
};
and set userName
rather than updating kube.currentUser
@@ -30,6 +30,9 @@ export default async (fastify: FastifyInstance): Promise<void> => { | |||
fastify.get('/', async (request, reply) => { | |||
return status(fastify) | |||
.then((res) => { | |||
if (request.headers['x-forwarded-user']) { | |||
(res.kube.currentUser as any) = request.headers['x-forwarded-user']; |
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.
Rather pass request
to the status
call and set the userName
there.
Added in a new line (red-hat-data-services#84) to provide instructions for downloading the Jupyter notebook. Updated step numbers for lines 85 - 88 accordingly since a new step 1 was added.
Since we use OpenShift oauth-proxy when the application is in a cluster, we can read the username directly from the headers
x-forwarded-user
field of the request that proxy transmits to the server.This PR changes the
status
API to read the username and send it back to the front-end.