-
Notifications
You must be signed in to change notification settings - Fork 20
Conversation
@marc-mabe I see your point and I agree that Possible solutions: @marc-mabe thoughts? |
Hi @ezimuel, Retrieving an object of Introducing an I like an additional What about something like that ?: namespace Zend\Expressive\Authentication;
interface UserInterface {
public function getUserIdentifier(): string;
}
class DefaultUser implements UserInterface {
public function getUserIdentifier(): string;
/** @deprecated */
public function getIdentifier() { return $this->getUserIdentifier(); }
}
namespace Zend\Expressive\Authentication\OAuth2;
use Zend\Expressive\Authentication\DefaultUser as BaseDefaultUser;
interface ClientInterface {
public function getClientIdentifier(): string;
}
class DefaultUser extends BaseDefaultUser implements ClientInterface {
public function getClientIdentifier(): string;
}
class DefaultClient implements ClientInterface {
public function getClientIdentifier(): string;
} |
@marc-mabe I like your approach but I would like to find an alternative solution without a BC break of |
The problem is that in OAuth2 there are two identities that needs to be authenticated - a client and optionally a user but The only BC break I see would be the renaming of The only way to solve that would be to keep the method
This way you can use:
I think this information just needs to go into user/client details as it happens already at least for now. |
@marc-mabe I've done some propotypes in order to support a I introduced a new |
sorry for the super late response - LGTM 👍 |
Running into this. There's a simple bug here that makes it difficult to load the client for |
webimpress requested my review here. The past year I've digged deeper into OAuth2 and gained a lot more knowledge. The issue with OAuth2 is that it is not really designed for user authentication. There is the password grant but it is not considered good practice. A better approach would be OpenID Connect. Having said that, if you own and or trust the server AND the application which requests a user authentication, only then the OAuth2 password grant could be used. In all other cases OpenID Connect should be used for user authentication. I agree that an IdentityInterface makes more sense. And adding OpenID Connect for user authentication would be welcome. |
Merged to master and develop for release with 1.2.1! |
Currently the
OAuth2Adapter
"hooks" into thezend-expressive-authentication
middleware as an adapter to manage authentication with OAuth2 and allows all forms of OAuth2 authentication.In OAuth2 there are two things that need to authenticate. First an application (OAuth2 client) and secondly a specific user but this user authentication can be omitted by some grant types like the
client credentials
grant as this is meant for server <-> server communication where no specific user resources are needed.The problem is that the
zend-expressive-authentication
expects to authenticate a user and not something else and returning the OAuth2 client identifier as user identifier forzend-expressive-authentication
can be very problematic.Because of that the OAuth2 client should never be treated as authenticated user.
This PR only makes sure that an authenticated user will be returned by
AuthenticationInterface
but not an authenticated OAuth2 client.Instead (not part of this PR as feature request) there should be another
AuthenticationMiddleware
specialized for authenticating OAuth2 clients - without the need for a user.Are you fixing a bug?
master
branch, and submit against that branch.CHANGELOG.md
entry for the fix.Are you creating a new feature?
develop
branch, and submit against that branch.CHANGELOG.md
entry for the new feature.Is this related to quality assurance?
Is this related to documentation?