-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix rooms not showing behind basic auth
This broke rooms on staging. This also appleis to various other API endpoints, but let's get rooms fixed to start with.
- Loading branch information
Showing
2 changed files
with
20 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import re | ||
from django.conf import settings | ||
from basicauth.middleware import BasicAuthMiddleware as BaseBasicAuthMiddleware | ||
|
||
|
||
# https://github.com/hirokiky/django-basicauth/issues/10 | ||
class BasicAuthMiddleware(BaseBasicAuthMiddleware): | ||
def process_request(self, request): | ||
always_allow_urls = map( | ||
re.compile, getattr(settings, "BASICAUTH_ALWAYS_ALLOW_URLS", []) | ||
) | ||
for allowed_url in always_allow_urls: | ||
if allowed_url.search(request.path): | ||
return None | ||
|
||
return super().process_request(request) |
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