Skip to content

Commit

Permalink
fixes for workspace auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Michel Käser committed Aug 11, 2015
1 parent ebe18ea commit 4f2ed3c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ipynbsrv/core/auth/checks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.http.response import HttpResponse
from ipynbsrv.wui.models import PortMapping
from ipynbsrv.core.models import PortMapping


COOKIE_NAME = 'username'
Expand Down
16 changes: 8 additions & 8 deletions ipynbsrv/web/settings.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
'''
"""
Setting storing the name of the cookie that is used to check access via the reverse proxy to containers.
'''
"""
AUTH_COOKIE_NAME = 'username'


'''
"""
Setting storing the name of the header that is indicating the requested URI, the reverse proxy is adding to sub-requests.
'''
"""
PROXY_URI_HEADER = 'HTTP_X_ORIGINAL_URI'


'''
"""
Setting storing the URL under which the application\'s documentation can be found.
'''
"""
URL_DOCS = '/docs/'


'''
"""
Setting storing the URL under which the user publications can be found.
'''
"""
URL_PUBLIC = '/public/'
4 changes: 2 additions & 2 deletions ipynbsrv/web/templates/web/snippets/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<li class="hidden-xs"><a href="" data-tooltip data-placement="bottom" title="User Guide" target="_blank">
<i class="glyphicon glyphicon-question-sign" aria-hidden="true"></i>
</a></li>
<li class="hidden-xs"><a href="{% settings 'PUBLIC_URL' %}{% request.user.get_username %}" data-tooltip data-placement="bottom" title="My publications" target="_blank">
<li class="hidden-xs"><a href="{% settings 'PUBLIC_URL' %}{{ request.user.get_username }}" data-tooltip data-placement="bottom" title="My publications" target="_blank">
<i class="glyphicon glyphicon-globe" aria-hidden="true"></i>
</a></li>
<li class="hidden-xs"><a href="/accounts/unflag" data-tooltip data-placement="bottom" title="Logout">
Expand All @@ -35,7 +35,7 @@
<a href="" title="User Guide" target="_blank">Use Guide</a>
</li>
<li class="hidden-sm hidden-md hidden-lg">
<a href="{% settings 'PUBLIC_URL' %}{% request.user.get_username %}" title="My publications" target="_blank">My publications</a>
<a href="{% settings 'PUBLIC_URL' %}{{ request.user.get_username }}" title="My publications" target="_blank">My publications</a>
</li>
<li class="hidden-sm hidden-md hidden-lg">
<a href="/accounts/unflag" title="Logout">Logout</a>
Expand Down
8 changes: 7 additions & 1 deletion lib/confs/nginx/ipynbsrv.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ server {
proxy_set_header X-Original-URI $request_uri;

proxy_pass_request_body off;
proxy_pass http://$host/_workspace_auth_check;
proxy_pass http://127.0.0.1/_workspace_auth_check;
}

# location for documentation
Expand Down Expand Up @@ -66,6 +66,12 @@ server {
set $decoded_backend '';
set_decode_hex $decoded_backend $1;

# use the Django error pages
# forbidden = 404 so the user doesn't know there is a container
# 50x grouped to 500
error_page 403 404 /error/404;
error_page 500 502 503 504 /error/500;

# needed for websockets connections
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
Expand Down

0 comments on commit 4f2ed3c

Please sign in to comment.