From c9164157e57aaab385370cfb4835fb0f4511cd4d Mon Sep 17 00:00:00 2001 From: "Tracy.Wu" Date: Thu, 8 Jul 2021 13:56:56 +0100 Subject: [PATCH] Fix possible key error --- fastapi_opa/auth/auth_saml.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fastapi_opa/auth/auth_saml.py b/fastapi_opa/auth/auth_saml.py index e6d83d9..3a99c34 100644 --- a/fastapi_opa/auth/auth_saml.py +++ b/fastapi_opa/auth/auth_saml.py @@ -48,7 +48,8 @@ async def authenticate( elif 'slo' in request.query_params: logger.debug(datetime.utcnow(), '--slo--') - del request.session['saml_session'] + if request.session.get('saml_session'): + del request.session['saml_session'] return await self.single_log_out(auth) elif 'sls' in request.query_params: