Is there anyway to create a user in Harbor when OIDC mode is on? #15526
-
Hi there, I read thru the doc and I'm aware that no manual adding users will be allowed once OIDC mode is on in Harbor. But I'm wondering if there's still a way to achieve that (create the user in Harbor before it is onboarded by login with OIDC provider the first time) Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Right, there is no way to do it. Can you give more details about why you have to add the user manually rather than auto onboarded? |
Beta Was this translation helpful? Give feedback.
-
I found this via google (originally I commented on #16647). I can use all APIs with the admin user, but I cannot use all APIs (without another token dance) with users that were setup via OIDC. So adding the capabilities to directly add accounts would be appreciated. |
Beta Was this translation helpful? Give feedback.
-
I know this is a super old thread but I think I have a use case that @Vad1mo / @wy65701436 might find interesting. We are managing access to our Harbor instance using an in-house coordination tool that also integrates with a number of other products. (Our Harbor uses OIDC for login.) The tool uses the Harbor API to grant permissions to projects, for users who may not have logged in yet. We create a usergroup and assign project permissions to it, and on the SSO provider side (Keycloak) we set up group membership for the user. Here's our "user creation" issue. We have to make the Harbor API calls using admin powers, because our tool can create usergroups and assign permissions to any project. But we want the tool to authenticate using an individual (attributable) service account, not the shared root-user admin / recovery username and password. We created a Keycloak client which can pull an OIDC access token, then send that in a Bearer header. This works, but first we need Harbor to know about the client. So, we have to assign a username and password to the client, and set up our OIDC login flow in Keycloak to allow user/pass auth -- we can browse to Harbor, log in with the KC client's user+pass, go through the initial user onboarding process (selecting a Harbor username), and now we have a Harbor User record for that KC client. At this point an existing Harbor admin can go to the User list and enable Admin permissions for it. Afterwards, we can remove the user+pass from the client and disable user+pass login for our OIDC flow -- the User has been created and associated with the OIDC userinfo record (subject etc), so when it provides a Bearer token on subsequent calls, Harbor knows who it's talking to, and that the "User" (client) has admin powers. It would be much easier if we could visit some API endpoint, presenting a Bearer token for the KC client, and have a Harbor User record created. Afterwards an existing Admin could visit the User list in Harbor and enable Admin permissions for the client. |
Beta Was this translation helpful? Give feedback.
Right, there is no way to do it. Can you give more details about why you have to add the user manually rather than auto onboarded?