· 6 years ago · Jun 23, 2019, 10:26 AM
1curl -X POST -H "Content-Type: application/json" docker-frontend.test/api/login-check -d '{"username":"admin@admin.com","password":"0000"}'
2
3curl -X GET -H "Content-Type: application/json" docker-frontend.test/api/login-check -d '{"username":"admin@admin.com","password":"0000"}'
4
5version: "3.1"
6services:
7
8 mysql:
9 image: mysql:5.7
10#5.7 weil 8.0 eine unbekannte authentifizierungsmethode bei symfony4 hat
11 container_name: docker-symfony4-mysql
12 working_dir: /backend
13 volumes:
14 - ./backend:/backend
15 environment:
16 - MYSQL_ROOT_PASSWORD=secret
17 - MYSQL_DATABASE=rest-backend
18 - MYSQL_USER=homestead
19 - MYSQL_PASSWORD=secret
20 ports:
21 - "127.0.3.3:8002:3306"
22
23 backend-server:
24 image: nginx:alpine
25 container_name: docker-rest-backend-server
26 working_dir: /backend
27 volumes:
28 - ./backend:/backend
29 - ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
30 ports:
31 - "127.0.3.2:80:80"
32 depends_on:
33 - mysql
34
35 php-fpm:
36 build: phpdocker/php-fpm
37 container_name: docker-rest-php-fpm
38 working_dir: /backend
39 volumes:
40 - ./backend:/backend
41 - ./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/7.2/fpm/conf.d/99-overrides.ini
42 depends_on:
43 - mysql
44
45 frontend-server:
46 image: nginx:alpine
47 container_name: docker-rest-frontend-server
48 working_dir: /frontend
49 volumes:
50 - ./frontend:/frontend
51 - ./phpdocker/nginx-frontend/nginx.conf:/etc/nginx/conf.d/default.conf
52 ports:
53 - "127.0.3.1:80:80"
54 depends_on:
55 - mysql
56
57security:
58 encoders:
59 AppEntityUser:
60 algorithm: argon2i
61 providers:
62 app_user_provider:
63 entity:
64 class: AppEntityUser
65 property: email
66 firewalls:
67 dev:
68 pattern: ^/(_(profiler|wdt)|css|images|js)/
69 security: false
70 login:
71 pattern: ^/api/login
72 stateless: true
73 anonymous: true
74 json_login:
75 check_path: /api/login_check
76 success_handler: lexik_jwt_authentication.handler.authentication_success
77 failure_handler: lexik_jwt_authentication.handler.authentication_failure
78 api:
79 pattern: ^/api
80 stateless: true
81 guard:
82 authenticators:
83 - lexik_jwt_authentication.jwt_token_authenticator
84 main:
85 anonymous: true
86 access_control:
87 - { path: ^/api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
88 - { path: ^/api, roles: IS_AUTHENTICATED_FULLY }
89
90lexik_jwt_authentication:
91 secret_key: '%kernel.project_dir%/config/jwt/private.pem'
92 public_key: '%kernel.project_dir%/config/jwt/public.pem'
93 pass_phrase: '%env(JWT_PASSPHRASE)%'
94 token_ttl: 3600
95
96api_login_check:
97 path: /api/login_check
98
99[...]
100JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
101JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
102JWT_PASSPHRASE=8e5433ff410b05fe7dbb26ef6cdf9bae