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

allow onyxia to inject OIDC token and refreshtoken in helm chart only on personal project #430

Closed
wants to merge 2,767 commits into from

Conversation

alexisdondon
Copy link
Contributor

That could be used to propagate identity of user in helm charts
should fix #410

@alexisdondon
Copy link
Contributor Author

alexisdondon commented Nov 22, 2022

Discuted with Frederic.

We could auhtoriez the ui to inject jwt and refreshtoken to be used in the helm chart but only on personal project to mitigate security issue in group namespaces.

@alexisdondon alexisdondon changed the title allow onyxia to inject OIDC token and refreshtoken in helm chart [WIP] allow onyxia to inject OIDC token and refreshtoken in helm chart Nov 22, 2022
@alexisdondon alexisdondon changed the title [WIP] allow onyxia to inject OIDC token and refreshtoken in helm chart allow onyxia to inject OIDC token and refreshtoken in helm chart only on personal project Nov 22, 2022
@alexisdondon
Copy link
Contributor Author

what's needed on this to be accepted?

"oidc": {
"enabled": project.group ? false : true,
"accessToken": project.group ? undefined : oidcClient.accessToken,
"refreshToken": project.group ? undefined : oidcClient.refreshToken
Copy link
Contributor

@garronej garronej Dec 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type system should be more transparent here.
project.group should be of type string | undefined.
Also we introduce the notion of group for only using it to tell if it's an empty string or not.
We should instead have a project.isPersonal: boolean.
Also, until now we assumed that the first project was the personal project. So we should update the part of the code where we made this assemption (serach for projects[0])

@@ -51,7 +51,7 @@ export function createPhonyOidcClient(params: {
"xxx"
);

return { accessToken };
return { accessToken, refreshToken: "phonyToken" };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"refreshToken": "phonyToken"

@@ -701,6 +701,7 @@ export function createOfficialOnyxiaApiClient(params: {
projects: {
id: string;
name: string;
group: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure of that?
Is it not group?: string ?
Seems more likely.

@@ -72,6 +72,7 @@ export async function createKeycloakOidcClient(params: {
const oidcClient = id<OidcClient.LoggedIn>({
"isUserLoggedIn": true,
"accessToken": keycloakInstance.token!,
"refreshToken": keycloakInstance.refreshToken!,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that when the accessToken is refreshed, the refreshToken changes as well.
Also, you should pull, this have been updated. It's now getToken()

@garronej
Copy link
Contributor

garronej commented Dec 4, 2022

Hey @alexisdondon,

Thank you for your work. Here is my review, sorry for the delay.

@garronej
Copy link
Contributor

garronej commented Jan 3, 2023

UP?

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.

Allow oidc jwt injection in the helm charts