Skip to content

Commit f9ad1e8

Browse files
committed
Remove Datasette plugin hook implementations
1 parent 8181dad commit f9ad1e8

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

asgi_auth_github/__init__.py

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +0,0 @@
1-
from datasette import hookimpl
2-
3-
from .github_auth import GitHubAuth
4-
5-
6-
@hookimpl
7-
def asgi_wrapper(datasette):
8-
config = datasette.plugin_config("datasette-auth-github") or {}
9-
client_id = config.get("client_id")
10-
client_secret = config.get("client_secret")
11-
disable_auto_login = bool(config.get("disable_auto_login"))
12-
allow_users = config.get("allow_users")
13-
allow_orgs = config.get("allow_orgs")
14-
allow_teams = config.get("allow_teams")
15-
cookie_ttl = config.get("cookie_ttl") or 60 * 60
16-
cookie_version = config.get("cookie_version")
17-
18-
# require_auth defaults to True unless set otherwise
19-
require_auth = True
20-
if "require_auth" in config:
21-
require_auth = config["require_auth"]
22-
23-
def wrap_with_asgi_auth(app):
24-
if not (client_id and client_secret):
25-
return app
26-
27-
return GitHubAuth(
28-
app,
29-
client_id=client_id,
30-
client_secret=client_secret,
31-
require_auth=require_auth,
32-
cookie_version=cookie_version,
33-
cookie_ttl=cookie_ttl,
34-
disable_auto_login=disable_auto_login,
35-
allow_users=allow_users,
36-
allow_orgs=allow_orgs,
37-
allow_teams=allow_teams,
38-
cacheable_prefixes=["/-/static/", "/-/static-plugins/"],
39-
)
40-
41-
return wrap_with_asgi_auth
42-
43-
44-
@hookimpl
45-
def extra_template_vars(request):
46-
return {"auth": request.scope.get("auth") if request else None}

0 commit comments

Comments
 (0)