File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -351,17 +351,19 @@ def is_ipaddress(hst):
351
351
# REST endpoints
352
352
httpAddress = hostname .get_action ("builtins.httpAddress" )
353
353
address = httpAddress ()
354
- domain = address .virtualHost
355
- # httpAddress action may return virtualHost = ''
356
- # if this happens, try the CAS host
357
- if not domain :
358
- domain = hostname ._sw_connection ._current_hostname
354
+ # Retrieve domain via swat connection object instead of httpAddress
355
+ domain = hostname ._sw_connection ._current_hostname
359
356
protocol = address .protocol
360
357
port = address .port
361
- auth = hostname ._sw_connection ._auth .decode ("utf-8" ).replace (
362
- "Basic " , ""
363
- )
364
- username , password = base64 .b64decode (auth ).decode ("utf-8" ).split (":" )
358
+ auth = hostname ._sw_connection ._auth .decode ("utf-8" )
359
+ # Checks to see if authentication was made via user/pass or auth token
360
+ if (auth .startswith ("Basic" )):
361
+ # User/pass
362
+ auth = auth .replace ("Basic " , "" )
363
+ username , password = base64 .b64decode (auth ).decode ("utf-8" ).split (":" )
364
+ elif (auth .startswith ("Bearer" )):
365
+ # Auth token
366
+ token = auth .replace ("Bearer " , "" )
365
367
else :
366
368
raise ValueError (
367
369
"A 'swat.CAS' session can only be reused "
You can’t perform that action at this time.
0 commit comments