mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-16 18:53:50 +01:00
Address review comments
This commit is contained in:
parent
79b9d9076d
commit
3bcb13edd0
1 changed files with 7 additions and 5 deletions
|
@ -18,7 +18,7 @@ import attr
|
||||||
import saml2
|
import saml2
|
||||||
from saml2.client import Saml2Client
|
from saml2.client import Saml2Client
|
||||||
|
|
||||||
from synapse.api.errors import CodeMessageException
|
from synapse.api.errors import SynapseError
|
||||||
from synapse.http.servlet import parse_string
|
from synapse.http.servlet import parse_string
|
||||||
from synapse.rest.client.v1.login import SSOAuthHandler
|
from synapse.rest.client.v1.login import SSOAuthHandler
|
||||||
|
|
||||||
|
@ -84,14 +84,16 @@ class SamlHandler:
|
||||||
outstanding=self._outstanding_requests_dict,
|
outstanding=self._outstanding_requests_dict,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Exception parsing SAML2 response", exc_info=1)
|
logger.warning("Exception parsing SAML2 response: %s", e)
|
||||||
raise CodeMessageException(400, "Unable to parse SAML2 response: %s" % (e,))
|
raise SynapseError(400, "Unable to parse SAML2 response: %s" % (e,))
|
||||||
|
|
||||||
if saml2_auth.not_signed:
|
if saml2_auth.not_signed:
|
||||||
raise CodeMessageException(400, "SAML2 response was not signed")
|
logger.warning("SAML2 response was not signed")
|
||||||
|
raise SynapseError(400, "SAML2 response was not signed")
|
||||||
|
|
||||||
if "uid" not in saml2_auth.ava:
|
if "uid" not in saml2_auth.ava:
|
||||||
raise CodeMessageException(400, "uid not in SAML2 response")
|
logger.warning("SAML2 response lacks a 'uid' attestation")
|
||||||
|
raise SynapseError(400, "uid not in SAML2 response")
|
||||||
|
|
||||||
self._outstanding_requests_dict.pop(saml2_auth.in_response_to, None)
|
self._outstanding_requests_dict.pop(saml2_auth.in_response_to, None)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue