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):
351351 # REST endpoints
352352 httpAddress = hostname .get_action ("builtins.httpAddress" )
353353 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
359356 protocol = address .protocol
360357 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 " , "" )
365367 else :
366368 raise ValueError (
367369 "A 'swat.CAS' session can only be reused "
You can’t perform that action at this time.
0 commit comments