Merge pull request #401 from edx/feature/ichuang/cas-authentication
Provide CAS authentication integration
This commit is contained in:
@@ -92,6 +92,7 @@ MITX_FEATURES = {
|
||||
'AUTH_USE_MIT_CERTIFICATES': False,
|
||||
'AUTH_USE_OPENID_PROVIDER': False,
|
||||
'AUTH_USE_SHIB': False,
|
||||
'AUTH_USE_CAS': False,
|
||||
|
||||
# This flag disables the requirement of having to agree to the TOS for users registering
|
||||
# with Shib. Feature was requested by Stanford's office of general counsel
|
||||
@@ -856,3 +857,14 @@ def enable_theme(theme_name):
|
||||
# avoid collisions with default edX static files
|
||||
STATICFILES_DIRS.append((u'themes/%s' % theme_name,
|
||||
theme_root / 'static'))
|
||||
|
||||
######################## CAS authentication ###########################
|
||||
|
||||
if MITX_FEATURES.get('AUTH_USE_CAS'):
|
||||
CAS_SERVER_URL = 'https://provide_your_cas_url_here'
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
'django_cas.backends.CASBackend',
|
||||
)
|
||||
INSTALLED_APPS += ('django_cas',)
|
||||
MIDDLEWARE_CLASSES += ('django_cas.middleware.CASMiddleware',)
|
||||
|
||||
@@ -363,6 +363,12 @@ if settings.MITX_FEATURES.get('AUTH_USE_SHIB'):
|
||||
url(r'^shib-login/$', 'external_auth.views.shib_login', name='shib-login'),
|
||||
)
|
||||
|
||||
if settings.MITX_FEATURES.get('AUTH_USE_CAS'):
|
||||
urlpatterns += (
|
||||
url(r'^cas-auth/login/$', 'external_auth.views.cas_login', name="cas-login"),
|
||||
url(r'^cas-auth/logout/$', 'django_cas.views.logout', {'next_page': '/'}, name="cas-logout"),
|
||||
)
|
||||
|
||||
if settings.MITX_FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD'):
|
||||
urlpatterns += (
|
||||
url(r'^course_specific_login/(?P<course_id>[^/]+/[^/]+/[^/]+)/$',
|
||||
|
||||
Reference in New Issue
Block a user