tomaj / nette-api

API solution for Nette framework with interactive generated console for each api
MIT License
36 stars 20 forks source link

Use relaxed TokenRepositoryInterface in BearerTokenAuthorization #112

Closed rootpd closed 3 years ago

rootpd commented 3 years ago

The deprecation of BearerTokenRepositoryInterface in favor of TokenRepositoryInterface requires people implementing the interface to change their implementation.

However if they do that and swap the interfaces, they can no longer use BearerTokenAuthorization in their API calls. The library is basically forcing everyone to keep using deprecated interface.

This commit fixes the issue and allows to use more relaxed TokenRepositoryInterface in BearerTokenAuthorization. This is backwards compatible change, because anyone implementing BearerTokenRepositoryInterface is already implementing TokenRepositoryInterface.

lulco commented 3 years ago

any autowiring issues after this change?

hope it will work :) 👍

rootpd commented 3 years ago

I can imagine there could be an issue if you had only one service implementing BearerTokenRepositoryInterface and at least one other service implementing also TokenRepositoryInterface. In that case you'd get multiple implementations error.

However I cannot think of scenario where someone would do that without replacing deprecated BearerTokenRepositoryInterface, or having the same issue we had (not being able to use BearerTokenAuthorization if we didn't implemented BearerTokenRepositoryInterface).

lulco commented 3 years ago

@tomaj can you merge and release please?