nette / security

🔑 Provides authentication, authorization and a role-based access control management via ACL (Access Control List)
https://doc.nette.org/access-control
Other
357 stars 40 forks source link

Change parameter name $user in Nette\Security\Authenticator to $username #73

Closed mildabre closed 2 weeks ago

mildabre commented 1 year ago

Hi,

interface Nette\Security\Authenticator has two string parameters: $user and $password. The name of the parameter $user may led to naming confusion in this cases:

a) with Nette\Security\User which is by default present in Nette presenters like $presenter->user and in Nette templates like $user

b) with the database table user - it is a common practice use table user with field username (login) for authentication

Therefore I propose to change the name of the parameter $user to $username like this:

interface Authenticator
{
    .......

    function authenticate(string $username, string $password): IIdentity;
}

github: https://github.com/nette/security/blob/0458647017a4b66cc6928c8c69ba86d66d5b2dc1/src/Security/Authenticator.php#L41