Add configuration flag to disable splitting keys on '.' #42
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.
I recently set up an instance of Kanboard using this plugin to sign in users through Slack. As part of the set-up, I wanted to have users grouped by the id of the workspace associated with their slack account. The Slack userInfo response does include this information under the key
https://slack.com/team_id
, so I configured the "Groups Key" to behttps://slack.com/team_id
.However, this created two issues:
https://slack.com/team_id
contains a '.', causing the GenericOAuth2UserProvider::getKey function to split it up. Essentially, the plugin thought that the key was referring to a member of a sub-object of the response, when it was actually just a literal '.' in the key.array_unique
to throw an error.My solution is the following:
oauth2_split_keys
setting, which will disable key splitting when set to '0'.$groups
in an array if it is not already an array. That way, if the "Groups Key" returns just a single group, it will be automatically wrapped into an array of length 1.