Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-cas
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
OpenEdx
django-cas
Commits
ed2ca9b0
Commit
ed2ca9b0
authored
Dec 07, 2010
by
Ed Crewe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch on proxy auth if PT ticket
parent
c59bbaf1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
django_cas/backends.py
+10
-4
django_cas/tests/cas_tests.py
+9
-3
No files found.
django_cas/backends.py
View file @
ed2ca9b0
...
...
@@ -96,8 +96,9 @@ def verify_proxy_ticket(ticket, service):
if
tree
[
0
]
.
tag
.
endswith
(
'authenticationSuccess'
):
username
=
tree
[
0
][
0
]
.
text
proxies
=
[]
for
element
in
tree
[
0
][
1
]:
proxies
.
append
(
element
.
text
)
if
len
(
tree
[
0
])
>
1
:
for
element
in
tree
[
0
][
1
]:
proxies
.
append
(
element
.
text
)
return
{
"username"
:
username
,
"proxies"
:
proxies
}
else
:
return
None
...
...
@@ -112,14 +113,19 @@ if settings.CAS_VERSION not in _PROTOCOLS:
_verify
=
_PROTOCOLS
[
settings
.
CAS_VERSION
]
SSO_PROXIED_PATHS
=
[
'http://localhost:56000/portal'
]
class
CASBackend
(
object
):
"""CAS authentication backend"""
def
authenticate
(
self
,
ticket
,
service
):
"""Verifies CAS ticket and gets or creates User object"""
username
=
_verify
(
ticket
,
service
)
if
ticket
.
startswith
(
'PT'
):
authdict
=
verify_proxy_ticket
(
ticket
,
service
)
if
authdict
:
username
=
authdict
.
get
(
'username'
,
''
)
else
:
username
=
_verify
(
ticket
,
service
)
if
not
username
:
return
None
try
:
...
...
django_cas/tests/cas_tests.py
View file @
ed2ca9b0
...
...
@@ -253,9 +253,14 @@ class TestCAS(unittest.TestCase):
return
'FAIL: PTURL=
%
s not found'
%
url
page
=
pt
.
read
()
if
page
.
find
(
'cas:serviceResponse'
)
>
-
1
:
pt_ticket
=
self
.
find_in_dom
(
page
,[
'cas:proxySuccess'
,
'cas:proxyTicket'
])
return
pt_ticket
try
:
pt_ticket
=
self
.
find_in_dom
(
page
,[
'cas:proxySuccess'
,
'cas:proxyTicket'
])
return
pt_ticket
except
:
print
url
print
page
return
''
return
None
...
...
@@ -268,6 +273,7 @@ class TestCAS(unittest.TestCase):
except
:
return
'FAIL: PTURL=
%
s not found'
%
url
page
=
login
.
read
()
print
url
if
page
.
find
(
'cas:authenticationSuccess'
)
>
-
1
:
proxy
=
self
.
find_in_dom
(
page
,[
'cas:proxies'
,
'cas:proxy'
])
...
...
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