Skip to content
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

Merged

Conversation

DaoDaoNoCode
Copy link

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.

Copy link

@jeff-phillips-18 jeff-phillips-18 left a 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'];

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.

@jeff-phillips-18 jeff-phillips-18 merged commit 96c1c68 into red-hat-data-services:master May 24, 2021
crobby pushed a commit to crobby/odh-dashboard that referenced this pull request Jun 3, 2021
anishasthana pushed a commit that referenced this pull request Jun 3, 2021
crobby pushed a commit that referenced this pull request Jun 3, 2021
crobby pushed a commit to crobby/odh-dashboard that referenced this pull request Sep 15, 2021
starburst-blumbert added a commit to starburst-blumbert/odh-dashboard that referenced this pull request May 6, 2022
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.
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.

None yet

2 participants