feathersjs-ecosystem / authentication-oauth2

[MOVED] OAuth 2 plugin for feathers-authentication
https://github.com/feathersjs/feathers
MIT License
26 stars 15 forks source link

Restricting certain email domains #75

Closed yanisIk closed 6 years ago

yanisIk commented 6 years ago

Hi,

I would like to allow only one domain to use the google oauth2 strategy. After reading the feathersjs documentation, I found that I have two options to customise the authentication:

After comparing both, the Verifier seems to be the right place to do what I want, but reimplementing it from scratch just to verify that the email address is allowed seems to be too much.

I came to this repo to copy paste the Verifier that comes with authentication-oauth2 and modify it, but the verify methods depends on all the others so I can't just tweak the verify method and use it in a empty class that extends Verifier (such as mentionned in the doc).

What's the best way to achieve that ?

Thanks.

daffl commented 6 years ago

The best place is probably in the users service as shown in the section about Customizing The OAuth Response.