lonnieezell / myth-auth

One-stop Auth package for CodeIgniter 4
MIT License
637 stars 208 forks source link

Deprecate Validator Class #515

Open MGatner opened 2 years ago

MGatner commented 2 years ago

BaseValidator and ValidatorInterface provide almost identical offerings. One of these should be deprecated, depending on whether the intent. Either:

Either solution should account for the following:

  1. The interface still uses CodeIgniter\Entity which is deprecated
  2. The interface method specifies Entity input when most validators require User
  3. PasswordValidator is not a valid interface class because of 2)
manageruz commented 2 years ago

Maybe keep them both and use an interface to specify the contract and an abstract class as just one implementation thereof?

MGatner commented 2 years ago

Shield has figured this out, it would probably make sense to imitate the solution there: https://github.com/codeigniter4/shield/tree/develop/src/Authentication/Passwords

manageruz commented 2 years ago

So we should modify ValidatorInterface.php :

  1. Replace use CodeIgniter\Entity with Myth\Auth\Entities\User
  2. Replace public function check(string $password, ?Entity $user = null): bool method with public function check(string $password, ?User $user = null): bool
  3. Do all necessary changes to all validators to use User class instead of Entity class.

Is that's all or am i missing something else?