'This is the HTTP-redirect endpoint'

def redirect(self):

    logger.info('---    In    SSO    Redirect    ---')
    _info = self.unpack_redirect()
    try:
        _key = _info['key']
        _info = IDP.ticket[_key]
        self.req_info = _info['req_info']
        del IDP.ticket[_key]
    except KeyError:
        try:
            self.req_info = IDP.parse_authn_request(_info['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 _info) and ('Signature' in _info)):
            issuer = _req.issuer.text
            _certs = IDP.metadata.certs(issuer, 'any', 'signing')
            verified_ok = False
            for cert in _certs:
                if verify_redirect_signature(_info, 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:
                _info['req_info'] = self.req_info
                key = self._store_request(_info)
                return self.not_authn(key, _req.requested_authn_context)
            else:
                return self.operation(_info, BINDING_HTTP_REDIRECT)
        else:
            _info['req_info'] = self.req_info
            key = self._store_request(_info)
            return self.not_authn(key, _req.requested_authn_context)
    else:
        return self.operation(_info, BINDING_HTTP_REDIRECT)
