Skip to content

Commit

Permalink
Don't fail, but issue a warning when detecting redirect fails
Browse files Browse the repository at this point in the history
  • Loading branch information
danchr committed Feb 28, 2023
1 parent 6f958d5 commit cf595d9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions openconnect_sso/authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,18 @@ async def authenticate(self, display_mode):
def _detect_authentication_target_url(self):
# Follow possible redirects in a GET request
# Authentication will occcur using a POST request on the final URL
response = self.session.get(self.host.vpn_url, verify=False)
response.raise_for_status()
self.host.address = response.url
logger.debug("Auth target url", url=self.host.vpn_url)
response = self.session.get(self.host.vpn_url, verify=False)
if response.ok:
self.host.address = response.url
else:
logger.warn(
"Failed to check for redirect",
reason=response.reason,
error=response.status_code,
response=response,
)
self.host.address = self.host.vpn_url

def _start_authentication(self):
request = _create_auth_init_request(self.host, self.host.vpn_url, self.version)
Expand Down

0 comments on commit cf595d9

Please sign in to comment.