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

Impersonation, SSO / bypass for specific users #367

Open
phpsa opened this issue Jun 6, 2024 · 3 comments
Open

Impersonation, SSO / bypass for specific users #367

phpsa opened this issue Jun 6, 2024 · 3 comments

Comments

@phpsa
Copy link
Contributor

phpsa commented Jun 6, 2024

would you accept a pull request that will extend the functionality to allow programatic choice on whether a user should be forced to 2fa?

@juliangums
Copy link
Contributor

juliangums commented Jun 25, 2024

I'd love to see that too. Ideally, something like this

BreezyCore::make()
    ->enableTwoFactorAuthentication(
        force: true,
        excludedDrivers: ['github', 'saml2'],
        impersonationByPass: true,
    )

to chose which Socialite drivers you want to exclude. But obviously a simple closure returning a boolean value that is then checked for each user would be just as good like

BreezyCore::make()
    ->enableTwoFactorAuthentication(
        force: true,
        bypass: fn (User $user): bool => $user->id === 1,
    )

or simply allow a closure or boolean for the force parameter:

BreezyCore::make()
    ->enableTwoFactorAuthentication(
        force: fn (User $user): bool => $user->id === 1,
    )

That'd be awesome. @phpsa did you work on that already?

@juliangums
Copy link
Contributor

Submitted a PR for this: #409

@juliangums
Copy link
Contributor

juliangums commented Jan 14, 2025

You can then do

BreezyCore::make()
    ->enableTwoFactorAuthentication(
        force: fn (): bool => auth()->user()->id === 1,
    )

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

No branches or pull requests

2 participants