· 7 years ago · Aug 21, 2018, 06:36 PM
1security:
2encoders:
3 AppEntityUtilisateur:
4 algorithm: bcrypt
5
6providers:
7 #in_memory: { memory: ~ }
8 our_db_provider:
9 entity:
10 class: AppEntityUtilisateur
11
12firewalls:
13 dev:
14 pattern: ^/(_(profiler|wdt)|css|images|js)/
15 security: false
16 login:
17 pattern: ^/api/login
18 stateless: true
19 anonymous: true
20 json_login:
21 check_path: /api/login_check
22 success_handler: lexik_jwt_authentication.handler.authentication_success
23 failure_handler: lexik_jwt_authentication.handler.authentication_failure
24
25 api:
26 pattern: ^/api
27 stateless: true
28 guard:
29 authenticators:
30 - lexik_jwt_authentication.jwt_token_authenticator
31
32 main:
33 pattern: ^/
34 user_checker: AppSecurityUtilisateurChecker
35 anonymous: true
36 provider: our_db_provider
37
38access_control:
39 - { path: ^/api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
40 - { path: ^/api, roles: IS_AUTHENTICATED_FULLY }
41
42lexik_jwt_authentication:
43 secret_key: '%kernel.project_dir%/config/jwt/private.pem' # required for token creation
44 public_key: '%kernel.project_dir%/config/jwt/public.pem' # required for token verification
45 pass_phrase: 'your_secret_passphrase' # required for token creation, usage of an environment variable is recommended
46 token_ttl: 3600
47
48lexik_jwt_authentication: secret_key: '%env(resolve:JWT_SECRET_KEY)%' public_key: '%env(resolve:JWT_PUBLIC_KEY)%' pass_phrase: '%env(JWT_PASSPHRASE)%'