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
2703c51a
Commit
2703c51a
authored
7 years ago
by
Art
Browse files
Options
Downloads
Patches
Plain Diff
Simplify development setup.
parent
760d49b0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ssoauth/app_settings/__init__.py
+9
-4
9 additions, 4 deletions
ssoauth/app_settings/__init__.py
ssoauth/app_settings/defaults.py
+1
-1
1 addition, 1 deletion
ssoauth/app_settings/defaults.py
ssoauth/apps.py
+3
-3
3 additions, 3 deletions
ssoauth/apps.py
with
13 additions
and
8 deletions
ssoauth/app_settings/__init__.py
+
9
−
4
View file @
2703c51a
...
@@ -17,10 +17,12 @@ for setting_name in [k for k in globals().keys() if k.isupper()]:
...
@@ -17,10 +17,12 @@ for setting_name in [k for k in globals().keys() if k.isupper()]:
# checks
# checks
SSO_DISABLED
=
SSO_DISABLED
or
getattr
(
conf
.
settings
,
"
IDP_IGNORE
"
,
False
)
# legacy config
if
not
SSO_DISABLED
:
assert
conf
.
settings
.
DEBUG
,
"
Not ignoring IDP on production.
"
assert
SP_HOST
and
SP_PORT
,
"
Need SP_HOST and SP_PORT configured in settings.
"
assert
SP_HOST
and
SP_PORT
,
"
Need SP_HOST and SP_PORT configured in settings.
"
assert
not
SP_HOST
.
lower
().
startswith
((
"
http:
"
,
"
https:
"
,)),
"
Need host name without protocol and port.
"
assert
not
SP_HOST
.
lower
().
startswith
((
"
http:
"
,
"
https:
"
,)),
"
Need host name without protocol and port.
"
# helpers
# helpers
_SET_ON_RUNTIME
=
None
and
"
doesn
'
t make sense to change it
"
_SET_ON_RUNTIME
=
None
and
"
doesn
'
t make sense to change it
"
...
@@ -41,6 +43,9 @@ def read_key(path):
...
@@ -41,6 +43,9 @@ def read_key(path):
with
open
(
path
,
"
r
"
)
as
f
:
with
open
(
path
,
"
r
"
)
as
f
:
return
f
.
read
()
return
f
.
read
()
except
FileNotFoundError
:
except
FileNotFoundError
:
if
SSO_DISABLED
:
return
None
else
:
raise
FileNotFoundError
(
"
SSO requires a key pair. Missing: {path}
"
.
format
(
path
=
path
))
raise
FileNotFoundError
(
"
SSO requires a key pair. Missing: {path}
"
.
format
(
path
=
path
))
...
...
This diff is collapsed.
Click to expand it.
ssoauth/app_settings/defaults.py
+
1
−
1
View file @
2703c51a
...
@@ -28,8 +28,8 @@ Settings you might want to change on development (don't change them for producti
...
@@ -28,8 +28,8 @@ Settings you might want to change on development (don't change them for producti
"""
"""
# development helpers
# development helpers
SSO_DISABLED
=
False
SP_FORCE_ENTITY_ID
=
None
# do NOT set for production, set to some unique string on development
SP_FORCE_ENTITY_ID
=
None
# do NOT set for production, set to some unique string on development
IDP_IGNORE
=
False
# ignore IDP entirely, SSO will not function
"""
"""
...
...
This diff is collapsed.
Click to expand it.
ssoauth/apps.py
+
3
−
3
View file @
2703c51a
...
@@ -13,9 +13,9 @@ class SSOAuthConfig(AppConfig):
...
@@ -13,9 +13,9 @@ class SSOAuthConfig(AppConfig):
def
ready
(
self
,
*
args
,
**
kwargs
):
def
ready
(
self
,
*
args
,
**
kwargs
):
super
().
ready
(
*
args
,
**
kwargs
)
super
().
ready
(
*
args
,
**
kwargs
)
# OneLogin settings stuff
# OneLogin settings stuff
if
app_settings
.
IDP_IGNORE
:
if
app_settings
.
SSO_DISABLED
:
assert
conf
.
settings
.
DEBUG
,
"
And how should SSO work on production if you ignore the IDP?
"
assert
conf
.
settings
.
DEBUG
logger
.
info
(
"
SSO
will not work
.
"
)
logger
.
debug
(
"
SSO
is disabled
.
"
)
else
:
else
:
try
:
try
:
app_settings
.
ONELOGIN_SETTINGS
=
sso_utils
.
create_onelogin_settings
(
app_settings
.
ONELOGIN_SETTINGS_TEMPLATE
)
app_settings
.
ONELOGIN_SETTINGS
=
sso_utils
.
create_onelogin_settings
(
app_settings
.
ONELOGIN_SETTINGS_TEMPLATE
)
...
...
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