Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Coughlin
GraceDB Server
Commits
d1de4b3b
Commit
d1de4b3b
authored
6 years ago
by
Tanner Prestegard
Committed by
GraceDB
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Rework URL check in shibboleth auth middleware
parent
30824721
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gracedb/core/http.py
+0
-16
0 additions, 16 deletions
gracedb/core/http.py
gracedb/ligoauth/middleware.py
+3
-3
3 additions, 3 deletions
gracedb/ligoauth/middleware.py
with
3 additions
and
19 deletions
gracedb/core/http.py
+
0
−
16
View file @
d1de4b3b
...
...
@@ -77,19 +77,3 @@ def check_and_serve_file(request, file_path, ResponseClass=HttpResponse):
response
=
serve_file
(
file_path
,
ResponseClass
)
return
response
def
request_is_for_view
(
viewname
,
request
):
"""
Returns True/False depending on whether the request is directed to
the view function corresponding to viewname.
"""
try
:
resolver_match
=
resolve
(
request
.
path
)
except
Resolver404
:
return
None
if
(
resolver_match
.
view_name
==
viewname
):
return
True
else
:
return
False
This diff is collapsed.
Click to expand it.
gracedb/ligoauth/middleware.py
+
3
−
3
View file @
d1de4b3b
...
...
@@ -6,8 +6,7 @@ from django.contrib import auth
from
django.contrib.auth.middleware
import
PersistentRemoteUserMiddleware
from
django.contrib.auth.models
import
Group
from
django.core.exceptions
import
ImproperlyConfigured
from
core.http
import
request_is_for_view
from
django.urls
import
reverse_lazy
# Set up logger
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -27,12 +26,13 @@ class ShibbolethWebAuthMiddleware(PersistentRemoteUserMiddleware):
user_header
=
getattr
(
settings
,
'
SHIB_USER_HEADER
'
,
'
REMOTE_USER
'
)
group_header
=
getattr
(
settings
,
'
SHIB_GROUPS_HEADER
'
,
'
isMemberOf
'
)
group_delimiter
=
'
;
'
active_url
=
reverse_lazy
(
'
post-login
'
)
def
process_request
(
self
,
request
):
# This middleware should *only* be active at the post-login URL
# where shibboleth is also active.
if
not
request
_is_for_view
(
'
post-login
'
,
request
):
if
not
(
request
.
path
==
self
.
active_url
):
return
# AuthenticationMiddleware is required so that request.user exists.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment