-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.auth.yml
57 lines (51 loc) · 2.05 KB
/
docker-compose.auth.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
version: "3.8"
services:
# Broker
emqx:
environment:
# Applying authn/authz only to the websocket listener as that is the only one publicly exposed
- EMQX_LISTENERS__WS__DEFAULT__ENABLE_AUTHN=true
- EMQX_LISTENERS__WS__DEFAULT__AUTHENTICATION__1__ENABLE=true
- EMQX_LISTENERS__WS__DEFAULT__AUTHENTICATION__1__MECHANISM=jwt
- EMQX_LISTENERS__WS__DEFAULT__AUTHENTICATION__1__ALGORITHM=hmac-based
- EMQX_LISTENERS__WS__DEFAULT__AUTHENTICATION__1__USE_JWKS=false
- EMQX_LISTENERS__WS__DEFAULT__AUTHENTICATION__1__SECRET="${PONTOS_JWT_SECRET}"
- EMQX_LISTENERS__WS__DEFAULT__AUTHENTICATION__1__SECRET_BASE64_ENCODED=false
- EMQX_LISTENERS__WS__DEFAULT__AUTHENTICATION__1__VERIFY_CLAIMS={sub:"$${username}"}
# Authorization must be global
- EMQX_AUTHORIZATION__NO_MATCH=deny
- EMQX_AUTHORIZATION__DENY_ACTION=disconnect
volumes:
- ./broker/acl.conf:/opt/emqx/etc/acl.conf
# REST api
api:
environment:
- PGRST_DB_ANON_ROLE=web_anon # Does NOT have read permissions!
- PGRST_OPENAPI_MODE=ignore-privileges # But we anyway show docs for the full API
- PGRST_OPENAPI_SECURITY_ACTIVE=true # And allow to manually input a JWT
- PGRST_JWT_SECRET=${PONTOS_JWT_SECRET}
- PGRST_JWT_SECRET_IS_BASE64=false
# JWT issuer
jwt:
build:
context: ./auth
restart: unless-stopped
environment:
- JWT_ISSUER="pontos-hub"
- JWT_EXPIRY=1M # 1 month
- JWT_SECRET=${PONTOS_JWT_SECRET}
- JWT_CLAIM_role=web_user
- JWT_CLAIM_sub=__token__
# Empty value to make sure we overwrite anything that comes through shell2http
- JWT_CLAIM_acl=
labels:
- "pontos.expose=true"
- "traefik.http.routers.jwt.rule=PathPrefix(`/token`)"
- "traefik.http.routers.jwt.entryPoints=web"
- "traefik.http.middlewares.jwt-stripprefix.stripprefix.prefixes=/token"
- "traefik.http.routers.jwt.middlewares=jwt-stripprefix@docker"
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"