你世道 / 令牌验证器
Symfony 扩展包,允许您使用基于令牌的认证
1.1.1
2020-11-26 22:12 UTC
Requires
- php: >=5.5
- symfony/framework-bundle: ~2.3|~3.0|~4.0
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"