Skip to content

Commit

Permalink
Fix path to oath when dev impersonating a user
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-phillips-18 committed Jan 13, 2025
1 parent ebc2c66 commit cbe4f4d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/src/routes/api/dev-impersonate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { KubeFastifyInstance } from '../../../types';
import { DEV_IMPERSONATE_PASSWORD, DEV_IMPERSONATE_USER } from '../../../utils/constants';
import { createCustomError } from '../../../utils/requestUtils';
import { devRoute } from '../../../utils/route-security';
import { isRHOAI } from '../../../utils/resourceUtils';

export default async (fastify: KubeFastifyInstance): Promise<void> => {
fastify.post(
Expand All @@ -16,7 +17,8 @@ export default async (fastify: KubeFastifyInstance): Promise<void> => {
if (doImpersonate) {
const apiPath = fastify.kube.config.getCurrentCluster().server;
const namedHost = apiPath.slice('https://api.'.length).split(':')[0];
const url = `https://oauth-openshift.apps.${namedHost}/oauth/authorize?response_type=token&client_id=openshift-challenging-client`;
const oathPrefix = isRHOAI(fastify) ? 'oauth' : 'oauth-openshift';
const url = `https://${oathPrefix}.${namedHost}/oauth/authorize?response_type=token&client_id=openshift-challenging-client`;
// Custom call, don't use proxy
const httpsRequest = https
.get(
Expand Down

0 comments on commit cbe4f4d

Please sign in to comment.