providers/saml: fix CannotHandleAssertion Error still being sent to sentry

This commit is contained in:
Jens Langhammer 2020-02-24 19:14:43 +01:00
parent 39a208c55f
commit c5b91bdae8
3 changed files with 4 additions and 5 deletions

View File

@ -137,6 +137,7 @@ class Event(UUIDModel):
action=self.action, action=self.action,
context=self.context, context=self.context,
client_ip=self.client_ip, client_ip=self.client_ip,
user=self.user,
) )
return super().save(*args, **kwargs) return super().save(*args, **kwargs)

View File

@ -32,13 +32,11 @@ def before_send(event, hint):
ValidationError, ValidationError,
OSError, OSError,
RedisError, RedisError,
SentryIgnoredException,
) )
if "exc_info" in hint: if "exc_info" in hint:
_exc_type, exc_value, _ = hint["exc_info"] _exc_type, exc_value, _ = hint["exc_info"]
# pylint: disable=consider-merging-isinstance if isinstance(exc_value, ignored_classes):
if isinstance(exc_value, ignored_classes) or isinstance(
exc_value, SentryIgnoredException
):
LOGGER.info("Supressing error %r", exc_value) LOGGER.info("Supressing error %r", exc_value)
return None return None
return event return event

View File

@ -105,7 +105,7 @@ class LoginBeginView(AccessRequiredView):
params = self.provider.processor.generate_response() params = self.provider.processor.generate_response()
request.session[SESSION_KEY_PARAMS] = params request.session[SESSION_KEY_PARAMS] = params
except CannotHandleAssertion as exc: except CannotHandleAssertion as exc:
LOGGER.error(exc) LOGGER.info(exc)
did_you_mean_link = request.build_absolute_uri( did_you_mean_link = request.build_absolute_uri(
reverse( reverse(
"passbook_providers_saml:saml-login-initiate", "passbook_providers_saml:saml-login-initiate",