-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-implement JWT gen in api-data-watcher-pusher
- Loading branch information
Showing
4 changed files
with
12 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
FROM alpine:3.11 | ||
|
||
RUN apk add --no-cache mysql-client tini openssl bash wget curl nodejs nodejs-npm \ | ||
&& npm config set unsafe-perm true \ | ||
&& npm -g install jwtgen | ||
RUN apk add --no-cache tini bash wget py3-jwt | ||
|
||
ENV JWTSECRET=super-secret-string \ | ||
JWTAUDIENCE=api.dev | ||
|
||
COPY api-watch-push.sh create_jwt.sh /home/ | ||
COPY api-watch-push.sh create_jwt.py /home/ | ||
|
||
CMD ["tini", "--", "/home/api-watch-push.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import jwt | ||
|
||
payload = {'role': 'admin', 'iss': 'api-data-watcher-pusher', | ||
'aud': os.environ['JWTAUDIENCE'], 'sub': 'api-data-watcher-pusher'} | ||
|
||
print(jwt.encode(payload, os.environ['JWTSECRET'], algorithm='HS256').decode()) |
This file was deleted.
Oops, something went wrong.