Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
9b7bb0dc
Commit
9b7bb0dc
authored
Feb 09, 2016
by
Omar Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make SAMLAuthBackend._config a cached_property
Cleaner, and keeps pylint happy
parent
2c4e97eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
common/djangoapps/third_party_auth/saml.py
+6
-3
No files found.
common/djangoapps/third_party_auth/saml.py
View file @
9b7bb0dc
...
...
@@ -3,6 +3,7 @@ Slightly customized python-social-auth backend for SAML 2.0 support
"""
import
logging
from
django.http
import
Http404
from
django.utils.functional
import
cached_property
from
social.backends.saml
import
SAMLAuth
,
OID_EDU_PERSON_ENTITLEMENT
from
social.exceptions
import
AuthForbidden
,
AuthMissingParameter
...
...
@@ -23,9 +24,6 @@ class SAMLAuthBackend(SAMLAuth): # pylint: disable=abstract-method
def
setting
(
self
,
name
,
default
=
None
):
""" Get a setting, from SAMLConfiguration """
if
not
hasattr
(
self
,
'_config'
):
from
.models
import
SAMLConfiguration
self
.
_config
=
SAMLConfiguration
.
current
()
# pylint: disable=attribute-defined-outside-init
try
:
return
self
.
_config
.
get_setting
(
name
)
except
KeyError
:
...
...
@@ -62,3 +60,8 @@ class SAMLAuthBackend(SAMLAuth): # pylint: disable=abstract-method
log
.
warning
(
"SAML user from IdP
%
s rejected due to missing eduPersonEntitlement
%
s"
,
idp
.
name
,
expected
)
raise
AuthForbidden
(
self
)
@cached_property
def
_config
(
self
):
from
.models
import
SAMLConfiguration
return
SAMLConfiguration
.
current
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment