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

Feature: Groups support for OIDC #4506

Merged
merged 1 commit into from
Sep 6, 2022
Merged

Conversation

mstrhakr
Copy link
Contributor

@mstrhakr mstrhakr commented Sep 5, 2022

So far I'm only able to test OIDC, but even that doesn't work at the moment.
There are some partially working bits, like checking requiredgroups and denying login.

This requires (for OIDC) a custom passport-openidconnect module until the pull to add group support goes through.

I would need help setting up the other auth strategies as I don't use any of the others.

@mstrhakr
Copy link
Contributor Author

mstrhakr commented Sep 5, 2022

I got user groups working with Authelia!

image

image

Now we need to figure out how to grab and feed groups from the other strategies.
I have Keycloak installed so I'll be doing some testing with SAML but I know nothing about SAML right now.

@mstrhakr
Copy link
Contributor Author

mstrhakr commented Sep 5, 2022

I've built a couple docker images for testing and they are now available, they include @mstrhakr/passport-openidconnect to get groups working.

Available Images:
mstrhakr/meshcentral:latest
mstrhakr/meshcentral:mongodb

@Ylianst
Copy link
Owner

Ylianst commented Sep 6, 2022

This look good to me. Other authentication strategies like Google, Reddit, GitHub, etc do not have user groups that I know off or in any case, would likely not benefit from user groups sync. This is work in progress, but I am ok merging it if you like. I will review the code for security, but so far, this is really good. I like how you reused the LDAP groups sync for OpenID.

@lgtm-com
Copy link

lgtm-com bot commented Sep 6, 2022

This pull request introduces 2 alerts when merging 556ca37 into b62e555 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable
  • 1 for Variable not declared before use

@mstrhakr mstrhakr force-pushed the oidc-groups branch 2 times, most recently from 8f4e9c9 to ea9a5b6 Compare September 6, 2022 04:01
@mstrhakr mstrhakr closed this Sep 6, 2022
@mstrhakr mstrhakr deleted the oidc-groups branch September 6, 2022 04:22
@mstrhakr mstrhakr restored the oidc-groups branch September 6, 2022 04:23
Supports choosing groups to..
  -Allow or restrict login to server
  -Sync with user groups (with / without filter)
  -Grant or revoke site admin privileges
@mstrhakr mstrhakr reopened this Sep 6, 2022
@mstrhakr
Copy link
Contributor Author

mstrhakr commented Sep 6, 2022

Please ignore all the crazy git nonsense I caused. I'm clearly an idiot because I decided to mess with the commits to make it look nicer. HA. Anyway, This is working great at the moment. It still require that custom module but it's a brand new fork of what we were already using with only the groups modification and the scope fix added. Dockers are building if anyone want's to test with that.

Really, the only thing I would say definitely needs testing is that the LDAP groups all still sync like you expect them to. I don't have that setup in Meshcentral at the moment but I can test it eventually. Well that and I wanted to ask if the way I'm doing the siteadmin stuff is okay or not. I think its okay, as it does work, it just was a little weird from my perspective.

@mstrhakr mstrhakr marked this pull request as ready for review September 6, 2022 04:38
@mstrhakr mstrhakr changed the title Feature: Group membership sync support for SSO logins Feature: Groups support for OIDC Sep 6, 2022
@Ylianst Ylianst merged commit ee11ef1 into Ylianst:master Sep 6, 2022
@Ylianst
Copy link
Owner

Ylianst commented Sep 6, 2022

Ok, working on testing it now.

@Ylianst
Copy link
Owner

Ylianst commented Sep 6, 2022

I just checked in a bunch of changes. I added the "SiteAdmin" feature to LDAP, I think that is a great idea. I also changed the debugging to debug to 'authlog`, this way you can see it on the web site in the "My Server / Trace" tab.

image

Once I release this with 1.0.83, can you test this again and make sure everything still works for you? - Thanks.

@mstrhakr
Copy link
Contributor Author

mstrhakr commented Sep 6, 2022

This looks great, I like that authlog bit, obviously I didn't know about that. I'll build myself a docker once it's live unless you want me to test now, it all looks amazing though.

@Ylianst
Copy link
Owner

Ylianst commented Sep 6, 2022

I just published v1.0.83, do let me know if it works for you. Tomorrow is my last day before 6 weeks vacation, but will be around a bit.

@Ylianst
Copy link
Owner

Ylianst commented Sep 6, 2022

Just noticed that OpenID-Client does not support older NodeJS versions, so added a warning on this:

image

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.

2 participants