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

Fix bug in geonode/people that throws error when using custom OIDC Identity Provider for user loggins #12041

Closed
JosephBannon opened this issue Mar 12, 2024 · 2 comments
Assignees

Comments

@JosephBannon
Copy link

Expected Behavior

I am using the geonode_openid_connect tag and configuring the SOCIALACCOUNT_PROVIDERS map to point to a local oidc identity provider. When I login with a user, they should be automatically added to a group if it exists in their access token and in geonode prior to login.

Actual Behavior

Right now there are small bugs in geonode/people/adapters.py and geonode/people/profileextractor.py. When I run my geonode, I configured it to login the user in via the oidc identity provider, it throws an error based on (line 311/312) in geonode/people/adapters.py and geonode/people/profileextractor.py (line 211).

Steps to Reproduce the Problem

  1. Set up an external oidc provider ( in my case keycloak)
  2. In the settings.py file, override the SOCAILACCOUNT_PROVDERS with this block of code based on your keycloak install
    image
    As well as these environment variables
    image
  3. Create user and groups in keycloak and a client to log in through
  4. As the geonode admin, create a group with the same name as the group a user is in in keycloak (both group names must be lowercase)
  5. In geonode UI, click login, log in via OpenId Connect
  6. This should result in an error

Specifications

  • GeoNode version: 4.2.2
  • Installation type (vanilla, geonode-project): vanilla
  • Installation method (manual, docker):
  • Platform: Ubuntu 22.04
  • Additional details:

Quick fix

Line 211 in geonode/people/profileextractor.py
image
Should be changed to
image

This is because on Line 311 in geonode/people/adapters.py to use the object.function notation in python the first argument in the method must be "self."
image

On Line 312 in geonode/people/adapters.py
image
Should be changed to
image

This is because on Line 215 in geonode/groups/models.py the "promote" method takes two arguments on of which is "self" and one of which is the user, however only the self argument is provided in the function call On Line 312 in geonode/people/adapters.py.
image

@giohappy giohappy assigned afabiani and unassigned giohappy Mar 14, 2024
@giohappy giohappy modified the milestone: 4.3.0 Mar 14, 2024
@afabiani
Copy link
Member

@JosephBannon could you please send a PR with the required changes?

afabiani added a commit that referenced this issue Mar 14, 2024
… custom OIDC Identity Provider for user loggins
@JosephBannon
Copy link
Author

@afabiani I see you made this change already, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants