Skip to content

Commit

Permalink
feat: a better static_storage_url handling
Browse files Browse the repository at this point in the history
  • Loading branch information
peppelinux committed Jun 14, 2021
1 parent 573853f commit 4ff7cae
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions example/backends/spidsaml2.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,13 @@ def handle_error(self, message:str, troubleshoot:str='',
loader=FileSystemLoader(searchpath=template_path),
autoescape=select_autoescape(['html'])
)
_static_url = (
self.config['static_storage_url']
if self.config['static_storage_url'][-1] == '/' else
self.config['static_storage_url'] + '/'
)
loader.globals.update({
'static': self.config['static_storage_url'],
'static': _static_url,
})
template = loader.get_template(template_name)
result = template.render({
Expand Down Expand Up @@ -441,17 +446,16 @@ def authn_response(self, context, binding):
**{
'err': err,
'message': 'Autenticazione fallita',
'troubleshoot': "Anomalia riscontrata durante la fase di Autenticazione."
" Contattare il supporto tecnico per eventuali chiarimenti"
'troubleshoot': f"Anomalia riscontrata durante la fase di Autenticazione. {_TROUBLESHOOT_MSG}"
}
)
except SignatureError as err:
return self.handle_error(
**{
'err': err,
'message': 'Autenticazione fallita',
'troubleshoot': "La firma digitale della risposta ottenuta non risulta essere corretta."
" Contattare il supporto tecnico per eventuali chiarimenti"
'troubleshoot': f"La firma digitale della risposta ottenuta non risulta essere corretta. {_TROUBLESHOOT_MSG}"

}
)
except Exception as err:
Expand Down Expand Up @@ -540,8 +544,6 @@ def authn_response(self, context, binding):
)
try:
validator.run()


except Exception as e:
logger.error(e)
return self.handle_error(e)
Expand Down

0 comments on commit 4ff7cae

Please sign in to comment.