Security/AccountStatusChecker.php

synaplan · backend/src/Security/AccountStatusChecker.php · php · Apache-2.0
auth

Security checker that blocks authentication for suspended or banned accounts.

// Source: https://github.com/metadist/synaplan | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
<?php

declare(strict_types=1);

namespace App\Security;

use App\Entity\User;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException;
use Symfony\Component\Security\Core\User\UserCheckerInterface;
use Symfony\Component\Security\Core\User\UserInterface;

/**
 * Rejects authentication for suspended or banned accounts (Apple Guideline 1.2:
 * "the ability to block abusive users").
 *
 * Wired as the firewall `user_checker`, so it runs for EVERY authenticator
 * (cookie/bearer token, API

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key