你世道/令牌验证器

Symfony 扩展包,允许您使用基于令牌的认证

安装次数: 8,020

依赖: 0

建议: 0

安全: 0

星标: 0

关注者: 4

分支: 2

类型:symfony-bundle

1.1.1 2020-11-26 22:12 UTC

README

此扩展包允许您使用类似于 OAuth 但更简化的令牌认证机制。

安装

首先,在您的 AppKernel 中通过将其添加到 registerBundles 方法来启用扩展包

...
            new Youshido\TokenAuthenticationBundle\TokenAuthenticationBundle(),

然后在 app/config/security.yml 下创建提供者和防火墙(如果您还没有编码器,也可以在这里添加)

security:
    providers:
        api_user_provider:
            id: token_user_provider

    encoders:
        AppBundle\Entity\User: md5

    firewalls:
        api_firewall:
            pattern: ^/.*
            stateless: true
            simple_preauth:
                authenticator: token_authenticator
            provider: api_user_provider
            anonymous: ~

现在将您的模型类名添加到服务声明中 app/config/config.yml

token_authentication:
    user_model: "AppBundle\\Entity\\User"