-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Ldap feature: Allow user login using username and reassign roles based on users' ldap groups when login #12503
Conversation
…les to user according to their LDAP group while login
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
* @return user info | ||
* @author Eric Wen@2023-07-16 17:06:43 | ||
*/ | ||
private User checkAndCreateUser(String email, String userName, String userDn) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be used as common method since we are using it for Admin creation as well cc @mohityadav766
@mohityadav766 lets take this up and merge it in. If we need to fix anything we can open a PR on top |
…n roles based on users' ldap groups when login
…dap groups when login (#14550) * Allow users to login with their user name in LDAP mode, and assign roles to user according to their LDAP group while login * Fix #12503: Ldap feature: Allow user login using username and reassign roles based on users' ldap groups when login --------- Co-authored-by: wentian <[email protected]> Co-authored-by: EricWent <[email protected]>
@EricWent @chirag-madlani
|
@mohityadav766 - Would you be able to share info on configuring this feature? I am using the latest helm chart for openmetadata 1.3.0 (pulled on 2/15/2024)
with below error
|
@metalshanked looks like there are some bugs in this code. We are looking into it. |
Thanks @harshach . Also, wanted to check on the way to switch to LDAP username in the sign in instead of email. (i think this was a new feature added recently.)
|
@harshach :- Is this fixed in the upcoming 1.3.1 prerelease? eagerly awaiting this thanks! |
I spent almost 3 days searching for the correct values for the variables.
it works for me |
Thanks @epollia . Would you have more details on these values specifically.
Since I have a different set of attributes. Eg:- memberof. |
The code looks for groups containing the user, not groups within the user. inside container or pod
|
Describe your changes:
This pull request added two new features for LDAP authentication scenarios:
Log in with username.
When using LDAP authentication, Openmetadata currently only allows users to login using their email. However, this poses some issues:
To address these issues, I modified the code in two classes: LdapAuthenticator and JwtFilter, to implement the logic for username-based login:
Reassign roles
When LDAP server already maintained the roles/groups of users, people might naturally expect that the roles will be automatically reassigned to users based on their roles/groups in LDAP during login, without requiring manual assignment by administrators every time.
Referring to the LDAP configuration options in airflow and flask-appbuilder, I have added several new env vars to implement this functionality:
AUTH_ROLES_MAPPING
: A mapping from LDAP/OAUTH group names to Openmetadata roles.AUTH_REASSIGN_ROLES
: To ensure that certain special roles will not be changed, only the roles specified in this array will be reassigned.AUTHENTICATION_USER_ROLE_ADMIN_NAME
: Considering that in Openmetadata, the admin is not a real existing role, this variable is used to specify the name used for configuring the admin role.Examples:
If you don't want to use the role reassignment feature, you just need to set AUTH_REASSIGN_ROLES to {} and AUTHENTICATION_USER_ROLE_ADMIN_NAME to [].
Reference materials:
flask-appbuilder's LDAP configuration: https://flask-appbuilder.readthedocs.io/en/latest/config.html
Type of change:
Checklist:
Fixes <issue-number>: <short explanation>