flownative / token-authentication
通用令牌身份验证。
README
本软件包为Neos Flow项目提供基于令牌的身份验证。它允许使用无会话和基于会话的身份验证。
安装
运行
composer require flownative/token-authentication
使用
运行
./flow hashtoken:createhashtoken --roleNames Neos.Neos:Editor
在请求中提供令牌
- 作为请求参数
_authenticationHashToken=<myToken>
或 - 作为带有值
Bearer <myToken>
的Authorization
头部。
配置
配置通常在 Configuration/Settings.yaml
文件中完成。
Neos: Flow: security: authentication: providers: 'Acme.Com:TokenAuthenticator': provider: Flownative\TokenAuthentication\Security\HashTokenProvider requestPatterns: 'Acme.Com:Controllers': pattern: ControllerObjectName patternOptions: controllerObjectNamePattern: 'Acme\Com\Controller\.*'
默认情况下,软件包使用无会话令牌。如果您想使用基于会话的令牌,请在提供者配置中将 token
选项设置为。
providers: 'Acme.Com:TokenAuthenticator': provider: Flownative\TokenAuthentication\Security\HashTokenProvider token: Flownative\TokenAuthentication\Security\SessionStartingHashToken