diff --git a/perun/proxy/utils/nagios/check_saml.py b/perun/proxy/utils/nagios/check_saml.py index da58eb9ec0b40057fdbe16a5bc9083b7701ce976..2c8929db2c95fadf288f1d258a39d542cbda9bca 100755 --- a/perun/proxy/utils/nagios/check_saml.py +++ b/perun/proxy/utils/nagios/check_saml.py @@ -290,19 +290,18 @@ class SAMLChecker: response = self.curl(url) response_html = response.read().decode("utf-8") response_url = response.url - if get_host_from_url(response_url) != ( - self.hosts[self.args.idp_host] - if self.args.idp_host in self.hosts - else self.args.idp_host - ): - response_html, response_url = self.js_form_redirect( - response_html, response_url - ) - if response_html is None: - self.finish( - "Initial URL does not redirect to IdP and JS redirect not detected", - "CRITICAL", - ) + + try_response_html, try_response_url = self.js_form_redirect( + response_html, response_url + ) + if try_response_html is None: + if self.args.verbose >= 1: + print("JS redirect not found on initial page") + else: + if self.args.verbose >= 1: + print("JS redirect found on initial page") + response_html = try_response_html + response_url = try_response_url return response_html, response_url def send_form(self, url, action, data):