Различия
Показаны различия между двумя версиями страницы.
Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
php:symfony:security [2024/04/15 21:03] – mirocow | php:symfony:security [2024/04/15 23:51] (текущий) – mirocow | ||
---|---|---|---|
Строка 2: | Строка 2: | ||
====== Security ====== | ====== Security ====== | ||
+ | |||
+ | config/ | ||
+ | <code yaml> | ||
+ | api_platform: | ||
+ | title: ' | ||
+ | description: | ||
+ | version: 1.0.0 | ||
+ | formats: | ||
+ | jsonld: [' | ||
+ | docs_formats: | ||
+ | jsonld: [' | ||
+ | jsonopenapi: | ||
+ | html: [' | ||
+ | swagger: | ||
+ | api_keys: | ||
+ | JWT: | ||
+ | name: Authorization | ||
+ | type: header | ||
+ | </ | ||
security.yaml | security.yaml | ||
Строка 19: | Строка 38: | ||
class: App\Entity\User | class: App\Entity\User | ||
property: username | property: username | ||
+ | |||
firewalls: | firewalls: | ||
- | | + | |
- | pattern: ^/api/login | + | pattern: ^/ |
+ | security: false | ||
+ | signup: | ||
+ | pattern: ^/api/users | ||
stateless: true | stateless: true | ||
- | | + | |
+ | methods: [POST] | ||
+ | authentication: | ||
+ | pattern: ^/ | ||
+ | stateless: true | ||
+ | anonymous: true | ||
json_login: | json_login: | ||
- | | + | |
- | success_handler: | + | |
- | failure_handler: | + | |
+ | failure_handler: | ||
api: | api: | ||
- | | + | |
- | stateless: true | + | stateless: true |
- | | + | anonymous: true |
+ | guard: | ||
+ | | ||
+ | - lexik_jwt_authentication.jwt_token_authenticator | ||
access_control: | access_control: | ||
- | | + | |
- | - { path: ^/docs, roles: | + | - { path: ^/api/users, roles: |
- | - { path: ^/api/login, roles: | + | |
- | - { path: ^/api, roles: IS_AUTHENTICATED_FULLY | + | |
</ | </ | ||
* app_user_provider - used to reload user from session & other features (e.g. switch_user) | * app_user_provider - used to reload user from session & other features (e.g. switch_user) | ||
+ | |||
+ | config/ | ||
+ | <code yaml> | ||
+ | lexik_jwt_authentication: | ||
+ | secret_key: ' | ||
+ | public_key: ' | ||
+ | pass_phrase: | ||
+ | token_ttl: 3600 | ||
+ | |||
+ | api_platform: | ||
+ | check_path: / | ||
+ | username_path: | ||
+ | password_path: | ||
+ | </ | ||
+ | |||
+ | config/ | ||
+ | <code yaml> | ||
+ | auth: | ||
+ | path: / | ||
+ | methods: [' | ||
+ | </ | ||
====== Symfony / API Platform ====== | ====== Symfony / API Platform ====== | ||
{{topic> | {{topic> |