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
a4eec822
Commit
a4eec822
authored
Mar 19, 2012
by
Sebastian Annies
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2 from matthewwithanm/no-nsmap-patch
Don't use namespaces kwarg when calling find
parents
45151289
a92227c0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
django_cas/__init__.py
+0
-1
django_cas/backends.py
+4
-4
django_cas/models.py
+3
-3
No files found.
django_cas/__init__.py
View file @
a4eec822
...
@@ -17,7 +17,6 @@ _DEFAULTS = {
...
@@ -17,7 +17,6 @@ _DEFAULTS = {
}
}
CAS_URI
=
'http://www.yale.edu/tp/cas'
CAS_URI
=
'http://www.yale.edu/tp/cas'
NSMAP
=
{
'cas'
:
CAS_URI
}
CAS
=
'{
%
s}'
%
CAS_URI
CAS
=
'{
%
s}'
%
CAS_URI
for
key
,
value
in
_DEFAULTS
.
iteritems
():
for
key
,
value
in
_DEFAULTS
.
iteritems
():
...
...
django_cas/backends.py
View file @
a4eec822
...
@@ -6,7 +6,7 @@ from urlparse import urljoin
...
@@ -6,7 +6,7 @@ from urlparse import urljoin
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.exceptions
import
ObjectDoesNotExist
from
django.core.exceptions
import
ObjectDoesNotExist
from
django_cas.models
import
User
,
Tgt
,
PgtIOU
from
django_cas.models
import
User
,
Tgt
,
PgtIOU
from
django_cas
import
CAS
,
NSMAP
from
django_cas
import
CAS
__all__
=
[
'CASBackend'
]
__all__
=
[
'CASBackend'
]
...
@@ -56,9 +56,9 @@ def _verify_cas2(ticket, service):
...
@@ -56,9 +56,9 @@ def _verify_cas2(ticket, service):
tree
=
ElementTree
.
fromstring
(
response
)
tree
=
ElementTree
.
fromstring
(
response
)
page
.
close
()
page
.
close
()
if
tree
.
find
(
CAS
+
'authenticationSuccess'
,
namespaces
=
NSMAP
)
is
not
None
:
if
tree
.
find
(
CAS
+
'authenticationSuccess'
)
is
not
None
:
username
=
tree
.
find
(
CAS
+
'authenticationSuccess/'
+
CAS
+
'user'
,
namespaces
=
NSMAP
)
.
text
username
=
tree
.
find
(
CAS
+
'authenticationSuccess/'
+
CAS
+
'user'
)
.
text
pgtIouIdElement
=
tree
.
find
(
CAS
+
'authenticationSuccess/'
+
CAS
+
'proxyGrantingTicket'
,
namespaces
=
NSMAP
);
pgtIouIdElement
=
tree
.
find
(
CAS
+
'authenticationSuccess/'
+
CAS
+
'proxyGrantingTicket'
);
pgtIouId
=
pgtIouIdElement
.
text
if
pgtIouIdElement
is
not
None
else
None
pgtIouId
=
pgtIouIdElement
.
text
if
pgtIouIdElement
is
not
None
else
None
if
pgtIouId
:
if
pgtIouId
:
...
...
django_cas/models.py
View file @
a4eec822
...
@@ -8,7 +8,7 @@ from django_cas.exceptions import CasTicketException, CasConfigException
...
@@ -8,7 +8,7 @@ from django_cas.exceptions import CasTicketException, CasConfigException
# Ed Crewe - add in signals to delete old tickets
# Ed Crewe - add in signals to delete old tickets
from
django.db.models.signals
import
post_save
from
django.db.models.signals
import
post_save
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
,
timedelta
from
django_cas
import
CAS
,
NSMAP
from
django_cas
import
CAS
class
Tgt
(
models
.
Model
):
class
Tgt
(
models
.
Model
):
username
=
models
.
CharField
(
max_length
=
255
,
unique
=
True
)
username
=
models
.
CharField
(
max_length
=
255
,
unique
=
True
)
...
@@ -38,8 +38,8 @@ class Tgt(models.Model):
...
@@ -38,8 +38,8 @@ class Tgt(models.Model):
try
:
try
:
response
=
page
.
read
()
response
=
page
.
read
()
tree
=
ElementTree
.
fromstring
(
response
)
tree
=
ElementTree
.
fromstring
(
response
)
if
tree
.
find
(
CAS
+
'proxySuccess'
,
namespaces
=
NSMAP
)
is
not
None
:
if
tree
.
find
(
CAS
+
'proxySuccess'
)
is
not
None
:
return
tree
.
find
(
CAS
+
'proxySuccess/'
+
CAS
+
'proxyTicket'
,
namespaces
=
NSMAP
)
.
text
return
tree
.
find
(
CAS
+
'proxySuccess/'
+
CAS
+
'proxyTicket'
)
.
text
else
:
else
:
raise
CasTicketException
(
"Failed to get proxy ticket"
)
raise
CasTicketException
(
"Failed to get proxy ticket"
)
finally
:
finally
:
...
...
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