Skip to content

Commit 0e50e0c

Browse files
committed
Fixed the way tokens are parsed and will now be stripped prior to
evaluation, vs. evaluated literally.
1 parent 6175dd5 commit 0e50e0c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

opensso.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# been included. None of the administrative methods are implemented... yet.
1414

1515
__author__ = 'Jathan McCollum <jathan+bitbucket@gmail.com>'
16-
__version__ = '0.1.2'
16+
__version__ = '0.1.3'
1717

1818
import urllib
1919
import urllib2
@@ -111,7 +111,8 @@ def is_token_valid(self, tokenid):
111111
params = {'tokenid':tokenid}
112112
data = self._GET(REST_OPENSSO_IS_TOKEN_VALID, params)
113113

114-
return data == 'boolean=true\r\n'
114+
# 'boolean=true\r\n' or 'boolean=true\n'
115+
return data.strip() == 'boolean=true'
115116

116117
def attributes(self, subjectid, attributes_names='uid', **kwargs):
117118
"""
@@ -148,7 +149,7 @@ def get_cookie_names_to_forward(self):
148149

149150
# Ditch the 'string=' crap and make into a list
150151
cookie_string = data.replace('string=', '')
151-
cookie_names = cookie_string.strip().split('\r\n')
152+
cookie_names = cookie_string.strip().splitlines()
152153

153154
return cookie_names
154155

@@ -205,7 +206,7 @@ def _parse_token(data):
205206
"""
206207
Slice/split the token and return it. Exceptions will fall through.
207208
"""
208-
# Server returns tokens as 'key=<value>\r\n'
209+
# Server returns tokens as 'key=<value>\r\n' or 'key=<value>\n'
209210
key, value = data.strip().split('=', 1)
210211
return value
211212

0 commit comments

Comments
 (0)