Различия
Показаны различия между двумя версиями страницы.
Следующая версия | Предыдущая версия | ||
php:symfony:security [2024/04/15 20:27] – создано mirocow | php:symfony:security [2024/04/15 23:51] (текущий) – mirocow | ||
---|---|---|---|
Строка 3: | Строка 3: | ||
====== 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 | ||
+ | <code yaml> | ||
+ | security: | ||
+ | enable_authenticator_manager: | ||
+ | | ||
+ | # https:// | ||
+ | password_hashers: | ||
+ | Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: | ||
+ | |||
+ | # https:// | ||
+ | providers: | ||
+ | # used to reload user from session & other features (e.g. switch_user) | ||
+ | app_user_provider: | ||
+ | entity: | ||
+ | class: App\Entity\User | ||
+ | property: username | ||
+ | |||
+ | firewalls: | ||
+ | dev: | ||
+ | pattern: ^/ | ||
+ | security: false | ||
+ | signup: | ||
+ | pattern: ^/api/users | ||
+ | stateless: true | ||
+ | anonymous: true | ||
+ | methods: [POST] | ||
+ | authentication: | ||
+ | pattern: ^/ | ||
+ | stateless: true | ||
+ | anonymous: true | ||
+ | json_login: | ||
+ | check_path: / | ||
+ | username_path: | ||
+ | success_handler: | ||
+ | failure_handler: | ||
+ | api: | ||
+ | pattern: ^/api | ||
+ | stateless: true | ||
+ | anonymous: true | ||
+ | guard: | ||
+ | authenticators: | ||
+ | - lexik_jwt_authentication.jwt_token_authenticator | ||
+ | |||
+ | access_control: | ||
+ | - { path: ^/ | ||
+ | - { path: ^/ | ||
+ | </ | ||
+ | |||
+ | * 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> |