Principal.php 411 B

12345678910111213141516
  1. <?php
  2. declare(strict_types=1);
  3. namespace app\miniapi\auth;
  4. /** Verified login identity. Mutable business permissions are always loaded through Access. */
  5. final class Principal
  6. {
  7. public function __construct(public readonly string $userId)
  8. {
  9. if ($userId === '' || strlen($userId) > 128) {
  10. throw new \InvalidArgumentException('Invalid mini-program user identity');
  11. }
  12. }
  13. }