Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to provide custom token repository creation logic #53351

Open
wants to merge 4 commits into
base: 11.x
Choose a base branch
from

Conversation

ollieread
Copy link
Contributor

This PR adds the ability to create custom token repositories for the password broker.

Custom creators are registered with the PasswordBrokerManager:

app('auth.password')->repository('redis', function ($app, $config) {
    return new RedisTokenRepository($config);
});

And provided in the config using the driver value:

[
  'passwords' => [
      'users' => [
          'provider' => 'users',
          'driver' => 'redis',
          'connection' => 'redis',
          'expire' => 60,
          'throttle' => 60,
      ],
  ],

If the driver config value is missing, or equal to database, the default implementation is used.

Note

I'm unsure how you want this to be tested, as this part of the codebase doesn't appear to be tested at all, instead, all the elements it interacts with are mocked and dealt with directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant