Skip to content

Commit 2602c65

Browse files
committed
Add OAuth2 support.
[skip ci]
1 parent bac9f3b commit 2602c65

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ __pycache__
77
.cache/*
88
**/.ipynb_checkpoints
99

10+
# Env variables
11+
.env
12+
1013
# OS generated files
1114
.DS_Store*
1215

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ WORKDIR /app
4444
CMD ["panel", "serve", "panel/app.py", \
4545
"--address", "0.0.0.0", "--port", "8080", "--num-procs", "2", "--allow-websocket-origin", "*", \
4646
"--cookie-secret", "panel_cookie_secret", \
47-
"--basic-login-template", "panel/login.html", \
4847
"--logout-template", "panel/logout.html", \
48+
"--oauth-provider", "google", \
4949
"--static-dirs", "_static=_static", \
50-
"--reuse-sessions", "--global-loading-spinner"]
50+
"--reuse-sessions", "--warm"]

Makefile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ ifndef project
1414
override project = delta-entity-401706
1515
endif
1616

17-
ifndef PANEL_TOKEN
18-
# only for local dev, another token is used for deployment
19-
override PANEL_TOKEN = e41ea4c145bf13a60c8779c24356
20-
endif
21-
2217

2318
# Add help text after each target name starting with '\#\#'
2419
help: ## show this help
@@ -44,14 +39,22 @@ serve-dev: ## Serve Panel dashboard - Dev mode
4439
--static-dirs _static=docs/_static \
4540
--reuse-sessions --warm
4641

47-
serve: ## Serve Panel dashboard - Prod mode
48-
PANEL_BASIC_AUTH=$(PANEL_TOKEN) panel serve panel/app.py \
42+
serve: ## Serve Panel dashboard - Prod mode with basic auth
43+
panel serve panel/app.py \
4944
--cookie-secret panel_cookie_secret \
5045
--basic-login-template panel/login.html \
5146
--logout-template panel/logout.html \
5247
--static-dirs _static=docs/_static \
5348
--reuse-sessions --warm
5449

50+
serve-oauth: ## Serve Panel dashboard - Prod mode with OAuth2
51+
panel serve panel/app.py \
52+
--cookie-secret panel_cookie_secret \
53+
--logout-template panel/logout.html \
54+
--oauth-provider google \
55+
--static-dirs _static=docs/_static \
56+
--reuse-sessions --warm
57+
5558
build-local:
5659
docker build -f ./Dockerfile \
5760
--build-arg PANEL_TOKEN=$(PANEL_TOKEN) \
@@ -99,7 +102,9 @@ production: publish-production
99102
--region=$(region) \
100103
--port=8080 \
101104
--set-env-vars ENV=production \
102-
--set-secrets=PANEL_BASIC_AUTH=PANEL_TOKEN:latest \
105+
--set-secrets=PANEL_OAUTH_REDIRECT_URI=PANEL_OAUTH_REDIRECT_URI:latest \
106+
--set-secrets=PANEL_OAUTH_KEY=PANEL_OAUTH_KEY:latest \
107+
--set-secrets=PANEL_OAUTH_SECRET=PANEL_OAUTH_SECRET:latest \
103108
--allow-unauthenticated \
104109
--session-affinity \
105110
--timeout=600 \

0 commit comments

Comments
 (0)