mama_cas/models.py
def validate_callback(self, service, pgturl, pgtid, pgtiou):
        """Verify the provided proxy callback URL."""
        if not proxy_allowed(service):
            raise UnauthorizedServiceProxy("%s is not authorized to use proxy authentication" % service)

        if not is_scheme_https(pgturl):
            raise InvalidProxyCallback("Proxy callback %s is not HTTPS" % pgturl)

        if not proxy_callback_allowed(service, pgturl):
            raise InvalidProxyCallback("%s is not an authorized proxy callback URL" % pgturl)

        # Verify that the SSL certificate is valid
        verify = os.environ.get('REQUESTS_CA_BUNDLE', True)
        try:
            requests.get(pgturl, verify=verify, timeout=5)
        except requests.exceptions.SSLError:
            raise InvalidProxyCallback("SSL certificate validation failed for proxy callback %s" % pgturl)
        except requests.exceptions.RequestException as e:
            raise InvalidProxyCallback(e)

        # Callback certificate appears valid, so send the ticket strings
        pgturl = add_query_params(pgturl, {'pgtId': pgtid, 'pgtIou': pgtiou})
        try:
            response = requests.get(pgturl, verify=verify, timeout=5)
        except requests.exceptions.RequestException as e:
            raise InvalidProxyCallback(e)

        try:
            response.raise_for_status()
        except requests.exceptions.HTTPError as e:
            raise InvalidProxyCallback("Proxy callback %s returned %s" % (pgturl, e))
Verify the provided proxy callback URL.
Verify the provided proxy callback URL.
Verify the provided proxy callback URL .
def validate_callback(self, service, pgturl, pgtid, pgtiou):
        if not proxy_allowed(service):
            raise UnauthorizedServiceProxy("%s is not authorized to use proxy authentication" % service)
        if not is_scheme_https(pgturl):
            raise InvalidProxyCallback("Proxy callback %s is not HTTPS" % pgturl)
        if not proxy_callback_allowed(service, pgturl):
            raise InvalidProxyCallback("%s is not an authorized proxy callback URL" % pgturl)
        verify = os.environ.get('REQUESTS_CA_BUNDLE', True)
        try:
            requests.get(pgturl, verify=verify, timeout=5)
        except requests.exceptions.SSLError:
            raise InvalidProxyCallback("SSL certificate validation failed for proxy callback %s" % pgturl)
        except requests.exceptions.RequestException as e:
            raise InvalidProxyCallback(e)
        pgturl = add_query_params(pgturl, {'pgtId': pgtid, 'pgtIou': pgtiou})
        try:
            response = requests.get(pgturl, verify=verify, timeout=5)
        except requests.exceptions.RequestException as e:
            raise InvalidProxyCallback(e)
        try:
            response.raise_for_status()
        except requests.exceptions.HTTPError as e:
            raise InvalidProxyCallback("Proxy callback %s returned %s" % (pgturl, e))
def validate_callback ( self , service , pgturl , pgtid , pgtiou ) : if not proxy_allowed ( service ) : raise UnauthorizedServiceProxy ( "%s is not authorized to use proxy authentication" % service ) if not is_scheme_https ( pgturl ) : raise InvalidProxyCallback ( "Proxy callback %s is not HTTPS" % pgturl ) if not proxy_callback_allowed ( service , pgturl ) : raise InvalidProxyCallback ( "%s is not an authorized proxy callback URL" % pgturl ) verify = os . environ . get ( 'REQUESTS_CA_BUNDLE' , True ) try : requests . get ( pgturl , verify = verify , timeout = 5 ) except requests . exceptions . SSLError : raise InvalidProxyCallback ( "SSL certificate validation failed for proxy callback %s" % pgturl ) except requests . exceptions . RequestException as e : raise InvalidProxyCallback ( e ) pgturl = add_query_params ( pgturl , { 'pgtId' : pgtid , 'pgtIou' : pgtiou } ) try : response = requests . get ( pgturl , verify = verify , timeout = 5 ) except requests . exceptions . RequestException as e : raise InvalidProxyCallback ( e ) try : response . raise_for_status ( ) except requests . exceptions . HTTPError as e : raise InvalidProxyCallback ( "Proxy callback %s returned %s" % ( pgturl , e ) )
Verify the provided proxy callback URL.
Verify the provided proxy callback URL .
"""Verify the provided proxy callback URL.""" # Verify that the SSL certificate is valid # Callback certificate appears valid, so send the ticket strings
self
service
pgturl
pgtid
pgtiou