doorkeeper-gem / doorkeeper-openid_connect

OpenID Connect extension for Doorkeeper
MIT License
173 stars 114 forks source link

Support multiple devise models #192

Open bilouw opened 1 year ago

bilouw commented 1 year ago

Hi !

My Rails app use devise and doorkeeper. My app have 2 (in fact 3, but let begin with 2) devise model: User and Customer.

Doorkeeper by default handle only one devise model. By that, i mean that generators and example are based on use case with only one devise model.

With some controllers override, we can make doorkeeper handle multiples devise models.

Now, i have the same problem with this gem. I found a workaround (the same thing i did with doorkeeper), but i want to know if there is a legacy way to do that, or if an PR could be done to handle that.

Let me explain: When i want to access the /.well-known/openid-configuration url, the DiscoveryController try to build the json object with some hardcoded helpers:

image

Because i have two devise model (in two namespaces), these helpers methods does not exists for me. What i did: Override the DiscoveryController in each of my namespaces, then override the provider_response methods to correct the helpers methods.

For now, that work !

But want to know if anybody have already handle this use case or if there is a best practice to handle this case.

Thanks !