-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Make use of roles when using OIDC #10016
Comments
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions. |
We would need such a feature as well. gitea/routers/user/auth_openid.go Line 320 in 76053ac
Here I see that username and password is extracted. We are using Keycloak and our use case is the following: We have Organisations and Teams. Do you think that is possible? |
Ẃe could use this feature, too. |
We need a uniform authorization synchronize mechanism for LDAP, OIDC or others. |
Harbor has it out of the box. You just provide it the name of the admin group in the OIDC groups claim for admins to be recognized. Teams can be given an OIDC group as well, so that incoming OIDC users can later be mapped. I don't believe they "sync" users but map them from their OIDC connector, so their db is empty of users. |
Having a consistent, unified source of identity and permission would be very convenient when working with a large group of people. This can be implemented with 2 steps:
I'd like to contribute a little if there is a plan from Gitea developers to implement this. |
We need this functionality to be able to allow login or not depending on a claim value in the access token. In our case, we use oauth2_client account auto registration but we don't want it to happen if the access token does not have a specific claim. I have spent some time this afternoon on a proof of concept: To make something as flexible as possible we added two new parameters in the
Do you think is it worth doing this way? |
Hmm... OK... I'm finally in the right place to look at this stuff. I think it's better to use the response that comes back from the provider - not the token - this is what Harbor does. I also think it's better to add the configuration to the UI instead of using the config file. My working tree is at: https://github.com/zeripath/gitea/tree/oidc-claims (this is based on 1.16) |
I don't think there is anyway we can get around having a db of users and the management that entails. If we had no db - we'd have no way of sending/storing notifications via email or on the UI, no ssh logins, no way of listing who can be '@'d and no gpg keys. (unless of course you assert LDAP only.) |
Couldn’t a user be recognized via oidc first and then a routine automatically creates a record in the db?
|
Yes and we do a part of that already - my comment was simply that we cannot get away without a DB. However if we want to extend what we take from OIDC we need to think about what happens when they log-in again. To manage LDAP providing SSH keys we now mark them with the loginsource associated with the key. This could be extendable to OAuth/OIDC providing SSH keys in the same way. For site administrator & restricted statuses: LDAP simply overrides and rewrites the statuses. I guess this is fine to replicate on the OAuth/OIDC equivalent. User visibility is not currently managed by LDAP. I suspect that this could simply be overridden by OIDC/OAuth/LDAP but I'm not sure that's the best thing to do - it really could need more thought. However, this is avoiding what is really wanted: Organization membership, team membership, & repository collaboration For this to be providable by OAuth/OIDC/LDAP we would need to mark the membership with the loginsource that provided that membership. This is probably doable - but is involved. In terms of the external configuration: I envision this could be done with two or three fields in OIDC/OAuth. Let's say
Another option would be to add |
I get from the documentation that it is going to be GroupClaimName, but I also see required-claim-name, required-claim-value, admin-group and restricted-group. Can you provide an example of a working JWT, so I can build it in Keycloak? |
The above PR is not delivering what is suggested. Seeing that In fact, the only thing made to work in that PR is the @zeripath was something left out of that PR? Can it be revived to fix that missing part? |
This comment was marked as duplicate.
This comment was marked as duplicate.
Is this still WIP? I am testing out OIDC using the |
With #19555 merged, should we change the title here to: "Allow mapping user to admin role with OIDC"? |
Admin group membership can already be mapped from an IdP like Keycloak. It seems to work only with flat token claim names, meaning a nested token name like In Gitea then set the following two fields (assuming client ID is
|
Thanks for that! Also: the claim must be included in the ID Token, not only in Authorization Token |
I follows these steps and it works for me. On Keycloak:
|
Description
We use Keycloak as our SSO system and Gitea uses this via OAuth2 (OIDC) to authenticate users. We have roles (admin/user) set up on Keycloak that are assigned to users. Is there a way to have Gitea assign admin rights to users if they have the 'admin' role?
The text was updated successfully, but these errors were encountered: