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
77c7d433
Commit
77c7d433
authored
7 years ago
by
Art
Browse files
Options
Downloads
Patches
Plain Diff
Add the description and the check to the backend setting.
parent
327a6cc9
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+1
-1
1 addition, 1 deletion
README.md
ssoauth/app_settings/defaults.py
+2
-1
2 additions, 1 deletion
ssoauth/app_settings/defaults.py
ssoauth/checks.py
+10
-0
10 additions, 0 deletions
ssoauth/checks.py
ssoauth/views.py
+2
-2
2 additions, 2 deletions
ssoauth/views.py
with
15 additions
and
4 deletions
README.md
+
1
−
1
View file @
77c7d433
...
...
@@ -42,7 +42,7 @@ SP_SSL = False
SP_FORCE_ENTITY_ID
=
"
dev-id-{0}-{1}
"
.
format
(
socket
.
gethostname
(),
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
)))
# too many localhosts around
LOGIN_URL
=
urls
.
reverse_lazy
(
"
sso-dev
"
)
LOGIN_URL
=
urls
.
reverse_lazy
(
"
sso-dev
"
)
# it's "sso-login" for prod
```
...
...
This diff is collapsed.
Click to expand it.
ssoauth/app_settings/defaults.py
+
2
−
1
View file @
77c7d433
...
...
@@ -55,6 +55,8 @@ SU_PERM_NAME = "superuser"
STAFF_GROUP_NAME
=
"
{0}_staff
"
.
format
(
PROJECT_NAME
)
STAFF_PERM_NAME
=
"
staff
"
PRETEND_AUTH_BACKEND
=
django_settings
.
AUTHENTICATION_BACKENDS
[
0
]
# pretend to be this backend; django does not expect that it is possible to log in without an authentication backend
"""
Not really settings...
...
...
@@ -88,4 +90,3 @@ SP_ORGANIZATION = {
},
}
DEFAULT_AUTH_BACKEND
=
django_settings
.
AUTHENTICATION_BACKENDS
[
0
]
This diff is collapsed.
Click to expand it.
ssoauth/checks.py
+
10
−
0
View file @
77c7d433
...
...
@@ -88,6 +88,16 @@ def sp_host_is_not_localhost(app_configs, **kwargs):
return
errors
@register
(
Tags
.
compatibility
)
def
pretend_backend
(
app_configs
,
**
kwargs
):
errors
=
list
()
pretend_expected
=
"
django.contrib.auth.backends.ModelBackend
"
if
app_settings
.
PRETEND_AUTH_BACKEND
!=
pretend_expected
:
errors
.
append
(
Warning
(
"
Please make sure the first element of AUTHENTICATION_BACKENDS is django.contrib.auth.backends.ModelBackend;
"
"
if you are not using this backend you need to ensure the first backend in the list knows how to get user by id/natural key
"
))
return
errors
@register
(
Tags
.
urls
)
def
auth_urls_configured
(
app_configs
,
**
kwargs
):
errors
=
list
()
...
...
This diff is collapsed.
Click to expand it.
ssoauth/views.py
+
2
−
2
View file @
77c7d433
...
...
@@ -177,7 +177,7 @@ class ACSAuthNView(SAMLMixin, View):
)
auth_utils
.
cleanup_direct_permissions
(
user
=
user
)
auth_utils
.
set_user_compat_flags
(
user
=
user
)
user
.
backend
=
app_settings
.
DEFAULT
_AUTH_BACKEND
user
.
backend
=
app_settings
.
PRETEND
_AUTH_BACKEND
request
.
user
=
user
contrib_auth
.
login
(
request
,
user
)
logger
.
debug
(
"
Logged in {user}
"
.
format
(
**
locals
()))
...
...
@@ -297,7 +297,7 @@ class DevView(FormView):
except
exceptions
.
ObjectDoesNotExist
:
import
uuid
user
=
auth_utils
.
get_or_create_user
(
username
=
log_in_as_username
,
uuid
=
uuid
.
uuid4
())
user
.
backend
=
app_settings
.
DEFAULT
_AUTH_BACKEND
user
.
backend
=
app_settings
.
PRETEND
_AUTH_BACKEND
self
.
request
.
user
=
user
contrib_auth
.
login
(
request
=
self
.
request
,
user
=
user
)
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