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

Add support for LDAP user profile attributes selection. #215

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kva1966
Copy link

@kva1966 kva1966 commented May 31, 2022

Description

Rationale

We have need for pulling in operational attributes which are not automatically brought in by LDAP searches, and require that they be specified explicitly in a query. In our case, we require an entryUUID LDAP attribute from our LDAP user records.

We have implemented this feature more generically to allow selecting/pulling in arbitrary attributes, hooking into the underlying LDAPjs library facility to specify attributes to bring back.

This feature may also provide data transfer efficiency gains for some use cases where a very specific subset of attributes are required, and no more. However, existing behaviour to bring in defaults (all minus operational attributes) is maintained. More in the Change Details below.

For further context, we then map our required attribute in a custom profileMapper.js to be included in the Auth0 normalised user profile.

No UI or API changes.

Change Details

Via new configuration option: LDAP_USER_BY_NAME_ATTRS, a value to pass through to the underlying LDAPjs library as the attributes option for Users.getByUserName.

Current behaviour is maintained, select the default set of attributes, which equates to a null value for the option.

To include operational attributes in addition to the defaults, use a list containing an asterisk (meaning defaults) and the operational attributes: [ "*", "att1", "att2" ]

To include ALL attributes, defaults and operational: [ "*", "+" ]

More generally, to select only specific attribute(s) (regular or operational), specify each in the list: [ "att1", "att2" ]

References

Testing

  • This change adds test coverage for new/changed/fixed functionality

New test cases added to test/users.unit.tests.js demonstrating the new configuration. Existing tests continue to work with the default configuration value.

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

Via new configuration option: `LDAP_USER_BY_NAME_ATTRS`, a value to pass
through to the underlying LDAPjs library as the `attributes` option
for `Users.getByUserName`.

Current behaviour is maintained, select the default set of attributes,
which equates to a null value for the option.

To include operational attributes in addition to the defaults, use
a list containing an asterisk (meaning defaults) and the operational
attributes: `[ "*", "att1", "att2" ]`

To include ALL attributes, defaults and operational: `[ "*", "+" ]`

More generally, to select only specific attribute(s) (regular or
operational), specify each in the list: `[ "att1", "att2" ]`
@kva1966 kva1966 requested a review from a team as a code owner May 31, 2022 07:16
@bworrell-auth0 bworrell-auth0 removed their request for review July 10, 2023 18:39
@phi1ipp
Copy link

phi1ipp commented Nov 22, 2023

That'd be a helpful. Just ran into a similar issue

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