fittinq/symfony-authenticator

此包的最新版本(13.0.0)没有可用的许可信息。

13.0.0 2024-03-08 15:48 UTC

README

用认证库保护您的服务

通过composer安装

composer require fittinq\symfony-authenticator

配置bundle

# config/bundles.php
<?php

return [
    // ...
    Fittinq\Symfony\Authenticator\SymfonyAuthenticatorBundle::class => ['all' => true],
];

.env

配置以下.env.local设置

AUTHENTICATOR_HOST_URL=dev.auth.hip.fittinq.com
AUTHENTICATOR_KEY_PUB=/var/www/app/auth.key.pub

设置security.yaml

security:
  enable_authenticator_manager: true

  providers:
    user_provider:
      id: Fittinq\Symfony\Authenticator\Authenticator\JwtUserProvider

  firewalls:
    unsecure:
      pattern: ^/(health|authenticator-callback)
      security: false
    secure:
      provider: user_provider
      custom_authenticators:
#        Depending on your problem, you can add either authenticator.
#        - Fittinq\Symfony\Authenticator\Authenticator\CookieAuthenticator
#        - Fittinq\Symfony\Authenticator\Authenticator\HeaderAuthenticator
          
  access_control:
    - {path: '^/users', roles: ROLE_ADMIN_AUTHENTICATOR}