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
a9ee4d36
Commit
a9ee4d36
authored
Dec 07, 2010
by
Ed Crewe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add redirect to proxy if PT check
parent
fffebc82
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
django_cas/tests/cas_tests.py
+21
-5
No files found.
django_cas/tests/cas_tests.py
View file @
a9ee4d36
...
...
@@ -75,11 +75,12 @@ class TestCAS(unittest.TestCase):
print
'-----------------------'
self
.
ticket
=
self
.
login
()
self
.
get_restricted
()
self
.
logout
()
print
''
print
'Test proxy CAS login'
print
'--------------------'
self
.
ticket
=
self
.
login
()
iou
=
self
.
proxy1_iou
()
if
iou
.
startswith
(
'PGT'
):
print
'PASS: Got IOU -
%
s for
%
s'
%
(
iou
,
self
.
urls
[
'proxy'
])
...
...
@@ -105,6 +106,9 @@ class TestCAS(unittest.TestCase):
else
:
print
'FAIL: The proxy login to
%
s via
%
s has failed'
%
(
self
.
urls
[
'app'
],
self
.
urls
[
'proxy'
])
self
.
logout
()
self
.
proxy5_login
(
pt
)
def
get_auth
(
self
):
""" Get authentication by passing to this script on the command line """
...
...
@@ -193,9 +197,19 @@ class TestCAS(unittest.TestCase):
print
'FAIL: Couldnt login to
%
s'
%
url
return
ticket
def
get_restricted
(
self
):
def
logout
(
self
):
""" Logout inbetween tests """
url
=
'
%
slogout'
%
self
.
urls
[
'cas'
]
app_resp
=
self
.
opener
.
open
(
url
)
app_resp
.
close
()
print
'Logged out'
return
def
get_restricted
(
self
,
ticket
=
''
):
""" Access a restricted URL and see if its accessible """
url
=
self
.
urls
[
'app'
]
+
APP_RESTRICTED
url
=
'
%
s
%
s'
%
(
self
.
urls
[
'app'
],
APP_RESTRICTED
)
if
ticket
:
url
=
'
%
s&ticket=
%
s'
%
(
url
,
ticket
)
app_resp
=
self
.
opener
.
open
(
url
)
ok
=
app_resp
.
code
==
200
app_resp
.
close
()
...
...
@@ -203,7 +217,6 @@ class TestCAS(unittest.TestCase):
print
'PASS: logged in to restricted app at
%
s'
%
url
else
:
print
'FAIL: couldnt log in to restricted app at
%
s'
%
url
return
def
proxy1_iou
(
self
):
""" Use login ticket to get proxy iou
...
...
@@ -273,12 +286,15 @@ 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'
])
return
proxy
return
None
def
proxy5_login
(
self
,
pt
):
""" Check if service redirects to proxy login if given a PT-ticket """
return
self
.
get_restricted
(
pt
)
if
__name__
==
'__main__'
:
unittest
.
main
()
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