grav-plugin-login-oauth2 icon indicating copy to clipboard operation
grav-plugin-login-oauth2 copied to clipboard

Google: extended `hd` whitelisting support

Open drzraf opened this issue 5 years ago • 10 comments

hd parameters allow to limit allowed users to those belonging to one specific GSuite domain (other values like * or unset allow every user). This is done by vendor/league/oauth2-google/src/Provider/Google.php::assertMatchingDomain() which is the last instruction done before Provider::getResourceOwner() returns.

This is not as flexible as possible as it may be desirable to provide whitelisted domains either as a list or a regexp, ... A flexible and future-proof solution would be to simply allow user-provided function to define this behavior (taking OIDC user-data as parameters and returning a boolean about whether user is accepted).

Do you think there could be room, either inBaseProvider.php or GoogleProvider.php for such an improvement?

drzraf avatar Apr 27 '19 01:04 drzraf

Please submit a PR against GoogleProvider for now.

rhukster avatar Apr 27 '19 15:04 rhukster

https://github.com/thephpleague/oauth2-google/pull/76

drzraf avatar May 03 '19 19:05 drzraf

Any comment on upstream PR?

drzraf avatar May 08 '19 11:05 drzraf

Up. Since upstream considered this to be up to library's consumers, could you please reconsider?

drzraf avatar Feb 25 '20 03:02 drzraf

ping

drzraf avatar May 10 '20 23:05 drzraf

Is there a PR to review?

rhukster avatar May 13 '20 21:05 rhukster

@drzraf What is the status of this one?

mahagr avatar May 13 '21 08:05 mahagr

If you feel that upstream rejection means it'd be adequate to do it within grav-plugin-login-oauth2 and likely to be merged, then I could try to come up with a PR. Please let me know in advance if you've any guidance and/or preferred way to resolve it.

drzraf avatar May 18 '21 14:05 drzraf

If it was rejected, we shouldn't add the feature. But that said, if they figured out another method to add it, I'm not against adding the support.

mahagr avatar May 18 '21 19:05 mahagr

They didn't reject the feature per-se but the implementation. Still the question is whether this sounds useful to other users.

I manage the GSuite for an organization which have multiple domains and users belonging to these domains. Without a patch I can't offer cross-domain logging (whitelisting more than one domain)

drzraf avatar Nov 11 '21 11:11 drzraf