'This is the HTTP-redirect endpoint'

def redirect(self):

    logger.info('---    In    SSO    Redirect    ---')
    saml_msg = self.unpack_redirect()
    try:
        _key = saml_msg['key']
        saml_msg = IDP.ticket[_key]
        self.req_info = saml_msg['req_info']
        del IDP.ticket[_key]
    except KeyError:
        try:
            self.req_info = IDP.parse_authn_request(saml_msg['SAMLRequest'], BINDING_HTTP_REDIRECT)
        except KeyError:
            resp = BadRequest('Message    signature    verification    failure')
            return resp(self.environ, self.start_response)
        _req = self.req_info.message
        if (('SigAlg' in saml_msg) and ('Signature' in saml_msg)):
            issuer = _req.issuer.text
            _certs = IDP.metadata.certs(issuer, 'any', 'signing')
            verified_ok = False
            for cert in _certs:
                if verify_redirect_signature(saml_msg, cert):
                    verified_ok = True
                    break
            if (not verified_ok):
                resp = BadRequest('Message    signature    verification    failure')
                return resp(self.environ, self.start_response)
        if self.user:
            if _req.force_authn:
                saml_msg['req_info'] = self.req_info
                key = self._store_request(saml_msg)
                return self.not_authn(key, _req.requested_authn_context)
            else:
                return self.operation(saml_msg, BINDING_HTTP_REDIRECT)
        else:
            saml_msg['req_info'] = self.req_info
            key = self._store_request(saml_msg)
            return self.not_authn(key, _req.requested_authn_context)
    else:
        return self.operation(saml_msg, BINDING_HTTP_REDIRECT)
