我想將我的 symfony 2.8 應用程式更新到 5.4 版。
我使用 fos rest bundle 進行 api 以及 jwt auth bundle 使用令牌進行身份驗證。我的問題是檢索令牌需要版本 2 上的“_username”欄位和版本 5 上的“用戶名”。
你能告訴我如何修改這個欄位,以便它可以對應我的舊配置嗎?
lexik_jwt_authentication:
private_key_path: '%jwt_private_key_path%'
public_key_path: '%jwt_public_key_path%'
pass_phrase: '%jwt_key_pass_phrase%'
token_ttl: '%jwt_token_ttl%'
我的 scurity.yaml
firewalls:
login:
pattern: ^/api/login
stateless: true
anonymous: true
form_login:
check_path: /api/login_check
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
require_previous_session: false
refresh:
pattern: ^/api/token/refresh
stateless: true
anonymous: true
api:
pattern: ^/api/secure
stateless: true
guard:
authenticators:
- word.user.guard.jwt_token_authenticator
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
logout: true
anonymous: true
uj5u.com熱心網友回復:
您可以使用組態檔username_path中的引數更改默認用戶名欄位scurity.yaml
firewalls:
login:
pattern: ^/api/login
stateless: true
anonymous: true
form_login:
username_path: YOUR_NEED_FIELD
check_path: /api/login_check
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/517432.html
標籤:phpapi交响乐森林捆绑lexikjwtauthbundle
