Fixed failure when LDAP does not supply profile.memberOf and/or groups are queried separately. #254
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The connector crashes in users.js if profile.memberOf is undefined. And, if the groups provided are already in an array, it inappropriately nests that array in the "mail" array in profileMapper.js. The work was done in the branch "fixgroups" in my fork, I left it there for review and merging on the master side.
These two problems were discovered when during a CIC Auth0 class delivery for Okta training where for a demonstration I was trying to link to an Okta LDAP Interface which does not return "memberOf" with the user information and requires the group membership to be queried separately.
Testing
Test with an LDAP server that does not return "memberOf". This was discovered using the connector against the Okta LDAP interface, which does not return the groups with the user. Test the groups against an LDAP server where the group membership has to be queried separately, like the Okta LDAP interface.
Unit/integration tests for these two cases do not appear to be present in the test suite, but I did not create them. I will leave the missing tests to the maintainers.
Checklist