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
3303fb12
Commit
3303fb12
authored
Feb 21, 2014
by
Carson Gee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Review fixes
parent
082f20db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
common/djangoapps/external_auth/tests/test_ssl.py
+7
-7
common/djangoapps/external_auth/views.py
+1
-1
No files found.
common/djangoapps/external_auth/tests/test_ssl.py
View file @
3303fb12
...
...
@@ -8,6 +8,7 @@ import StringIO
import
unittest
from
django.conf
import
settings
from
django.contrib.auth
import
SESSION_KEY
from
django.contrib.auth.models
import
AnonymousUser
,
User
from
django.contrib.sessions.middleware
import
SessionMiddleware
from
django.core.urlresolvers
import
reverse
...
...
@@ -170,7 +171,7 @@ class SSLClientTest(TestCase):
reverse
(
'dashboard'
),
follow
=
True
,
SSL_CLIENT_S_DN
=
self
.
AUTH_DN
.
format
(
self
.
USER_NAME
,
self
.
USER_EMAIL
))
self
.
assertIn
(
reverse
(
'dashboard'
),
response
[
'location'
])
self
.
assertIn
(
'_auth_user_id'
,
self
.
client
.
session
)
self
.
assertIn
(
SESSION_KEY
,
self
.
client
.
session
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@override_settings
(
FEATURES
=
FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP
)
...
...
@@ -183,7 +184,7 @@ class SSLClientTest(TestCase):
reverse
(
'register_user'
),
follow
=
True
,
SSL_CLIENT_S_DN
=
self
.
AUTH_DN
.
format
(
self
.
USER_NAME
,
self
.
USER_EMAIL
))
self
.
assertIn
(
reverse
(
'dashboard'
),
response
[
'location'
])
self
.
assertIn
(
'_auth_user_id'
,
self
.
client
.
session
)
self
.
assertIn
(
SESSION_KEY
,
self
.
client
.
session
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'cms.urls'
,
'Test only valid in cms'
)
@override_settings
(
FEATURES
=
FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP
)
...
...
@@ -199,7 +200,7 @@ class SSLClientTest(TestCase):
reverse
(
'signup'
),
follow
=
True
,
SSL_CLIENT_S_DN
=
self
.
AUTH_DN
.
format
(
self
.
USER_NAME
,
self
.
USER_EMAIL
))
# assert that we are logged in
self
.
assertIn
(
'_auth_user_id'
,
self
.
client
.
session
)
self
.
assertIn
(
SESSION_KEY
,
self
.
client
.
session
)
# Now that we are logged in, make sure we don't see the registration page
with
self
.
assertRaisesRegexp
(
InsufficientSpecificationError
,
...
...
@@ -225,7 +226,7 @@ class SSLClientTest(TestCase):
reverse
(
'signin_user'
),
follow
=
True
,
SSL_CLIENT_S_DN
=
self
.
AUTH_DN
.
format
(
self
.
USER_NAME
,
self
.
USER_EMAIL
))
self
.
assertIn
(
reverse
(
'dashboard'
),
response
[
'location'
])
self
.
assertIn
(
'_auth_user_id'
,
self
.
client
.
session
)
self
.
assertIn
(
SESSION_KEY
,
self
.
client
.
session
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
...
...
@@ -246,11 +247,10 @@ class SSLClientTest(TestCase):
user
.
save
()
# Make sure we can still login
response
=
self
.
client
.
get
(
self
.
client
.
get
(
reverse
(
'signin_user'
),
follow
=
True
,
SSL_CLIENT_S_DN
=
self
.
AUTH_DN
.
format
(
self
.
USER_NAME
,
self
.
USER_EMAIL
))
print
(
response
)
self
.
assertIn
(
'_auth_user_id'
,
self
.
client
.
session
)
self
.
assertIn
(
SESSION_KEY
,
self
.
client
.
session
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@override_settings
(
FEATURES
=
FEATURES_WITHOUT_SSL_AUTH
)
...
...
common/djangoapps/external_auth/views.py
View file @
3303fb12
...
...
@@ -197,7 +197,7 @@ def _external_login_or_signup(request,
elif
uses_certs
:
# Certificates are trusted, so just link the user and log the action
user
=
internal_user
user
.
backend
=
'django.contrib.auth.backens.ModelBackend'
user
.
backend
=
'django.contrib.auth.backen
d
s.ModelBackend'
AUDIT_LOG
.
info
(
'Linked user "
%
s" logged in via SSL certificate'
,
user
.
email
)
else
:
user
=
authenticate
(
username
=
uname
,
password
=
eamap
.
internal_password
,
request
=
request
)
...
...
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