Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jhub_remote_user_authenticator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RWTHjupyter
Upstream
jhub_remote_user_authenticator
Commits
db69872f
Commit
db69872f
authored
2 years ago
by
Steffen Vogel
Browse files
Options
Downloads
Patches
Plain Diff
Rename old usernames based on pesistent-hash to pairwise-id usernames
This is a special migration strategy solely for RWTHjupyter!
parent
72cab95b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jhub_remote_user_authenticator/remote_user_auth.py
+16
-13
16 additions, 13 deletions
jhub_remote_user_authenticator/remote_user_auth.py
with
16 additions
and
13 deletions
jhub_remote_user_authenticator/remote_user_auth.py
+
16
−
13
View file @
db69872f
...
...
@@ -10,13 +10,24 @@ from traitlets import Unicode
class
RemoteUserLoginHandler
(
BaseHandler
):
def
get
(
self
):
header_name
=
self
.
authenticator
.
header_name
remote_user
=
self
.
request
.
headers
.
get
(
header_name
,
""
)
user_persistent_hash
=
self
.
request
.
headers
.
get
(
"
persistent-hash
"
,
""
)
user_pairwise_id
=
self
.
request
.
headers
.
get
(
"
pairwise-id
"
,
""
)
if
remote_user
==
""
:
if
user_persistent_hash
==
""
and
user_pairwise_id
==
""
:
self
.
welcome_page
()
else
:
user
=
self
.
user_from_username
(
remote_user
)
# Rename old user names using persistent hash to pairwise-id names
# TODO: remove once all users use new pairwise-id name
# Only possible as soon as user-lifecycle has been activated.
user
=
self
.
find_user
(
user_persistent_hash
)
if
user
is
not
None
:
user
.
name
=
user_pairwise_id
user
.
db
.
commit
()
self
.
log
.
info
(
"
Renamed old persistent-hash user
'
%s
'
to
'
%s
'"
,
user_persistent_hash
,
user_pairwise_id
)
# TODO END
user
=
self
.
user_from_username
(
user_pairwise_id
)
self
.
set_login_cookie
(
user
)
next_url
=
self
.
get_next_url
(
user
)
...
...
@@ -46,10 +57,6 @@ class RemoteUserAuthenticator(Authenticator):
"""
Accept the authenticated user name from the REMOTE_USER HTTP header.
"""
header_name
=
Unicode
(
default_value
=
'
REMOTE_USER
'
,
config
=
True
,
help
=
"""
HTTP header to inspect for the authenticated username.
"""
)
def
get_handlers
(
self
,
app
):
return
[
...
...
@@ -57,7 +64,7 @@ class RemoteUserAuthenticator(Authenticator):
]
def
login_url
(
self
,
base_url
):
return
self
.
domain
+
'
/Shibboleth.sso/Login
return
self
.
domain
+
'
/Shibboleth.sso/Login
'
def
logout_url
(
self
,
base_url
):
return
self
.
domain
+
'
/Shibboleth.sso/Logout?return=/
'
...
...
@@ -73,10 +80,6 @@ class RemoteUserLocalAuthenticator(LocalAuthenticator):
Derived from LocalAuthenticator for use of features such as adding
local accounts through the admin interface.
"""
header_name = Unicode(
default_value=
'
REMOTE_USER
'
,
config=True,
help=
"""
HTTP header to inspect for the authenticated username.
"""
)
def
get_handlers
(
self
,
app
):
return
[
...
...
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