Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ssoauth
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
django
ssoauth
Commits
327a6cc9
Commit
327a6cc9
authored
7 years ago
by
schulmax
Browse files
Options
Downloads
Patches
Plain Diff
Set default authentication backend on user for django.contrib.auth.login
parent
be670f75
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-2
2 additions, 2 deletions
.gitignore
ssoauth/app_settings/defaults.py
+3
-0
3 additions, 0 deletions
ssoauth/app_settings/defaults.py
ssoauth/views.py
+4
-2
4 additions, 2 deletions
ssoauth/views.py
with
9 additions
and
4 deletions
.gitignore
+
2
−
2
View file @
327a6cc9
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
*~
*~
*.egg-info/
*.egg-info/
.idea/
.idea/
.project
/
.project
.pydevproject
/
.pydevproject
This diff is collapsed.
Click to expand it.
ssoauth/app_settings/defaults.py
+
3
−
0
View file @
327a6cc9
import
os
import
os
from
django
import
urls
from
django
import
urls
from
django.conf
import
settings
as
django_settings
"""
"""
...
@@ -86,3 +87,5 @@ SP_ORGANIZATION = {
...
@@ -86,3 +87,5 @@ SP_ORGANIZATION = {
"
url
"
:
"
https://www.hs-hannover.de
"
,
"
url
"
:
"
https://www.hs-hannover.de
"
,
},
},
}
}
DEFAULT_AUTH_BACKEND
=
django_settings
.
AUTHENTICATION_BACKENDS
[
0
]
This diff is collapsed.
Click to expand it.
ssoauth/views.py
+
4
−
2
View file @
327a6cc9
...
@@ -177,6 +177,7 @@ class ACSAuthNView(SAMLMixin, View):
...
@@ -177,6 +177,7 @@ class ACSAuthNView(SAMLMixin, View):
)
)
auth_utils
.
cleanup_direct_permissions
(
user
=
user
)
auth_utils
.
cleanup_direct_permissions
(
user
=
user
)
auth_utils
.
set_user_compat_flags
(
user
=
user
)
auth_utils
.
set_user_compat_flags
(
user
=
user
)
user
.
backend
=
app_settings
.
DEFAULT_AUTH_BACKEND
request
.
user
=
user
request
.
user
=
user
contrib_auth
.
login
(
request
,
user
)
contrib_auth
.
login
(
request
,
user
)
logger
.
debug
(
"
Logged in {user}
"
.
format
(
**
locals
()))
logger
.
debug
(
"
Logged in {user}
"
.
format
(
**
locals
()))
...
@@ -296,6 +297,7 @@ class DevView(FormView):
...
@@ -296,6 +297,7 @@ class DevView(FormView):
except
exceptions
.
ObjectDoesNotExist
:
except
exceptions
.
ObjectDoesNotExist
:
import
uuid
import
uuid
user
=
auth_utils
.
get_or_create_user
(
username
=
log_in_as_username
,
uuid
=
uuid
.
uuid4
())
user
=
auth_utils
.
get_or_create_user
(
username
=
log_in_as_username
,
uuid
=
uuid
.
uuid4
())
user
.
backend
=
app_settings
.
DEFAULT_AUTH_BACKEND
self
.
request
.
user
=
user
self
.
request
.
user
=
user
contrib_auth
.
login
(
request
=
self
.
request
,
user
=
user
)
contrib_auth
.
login
(
request
=
self
.
request
,
user
=
user
)
elif
toggle_group
:
elif
toggle_group
:
...
...
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