djangosaml2 icon indicating copy to clipboard operation
djangosaml2 copied to clipboard

Add CSP handler setting

Open GertBurger opened this issue 1 year ago • 3 comments

Fixes #397

This PR adds the SAML_CSP_HANDLER setting so that users can specify how CSP should be updated, if at all. The default behaviour of using django-csp remains the same.

GertBurger avatar Mar 10 '24 17:03 GertBurger

@peppelinux How do you feel about the overall approach taken?

GertBurger avatar Mar 11 '24 08:03 GertBurger

Good feature,

however this must be refactored: https://github.com/IdentityPython/djangosaml2/pull/401/files#diff-fcaad0de48c174c47b13c1ff9c42a101f319429573505b1120123d31bfe791c8R220

we have to reduce the nested if statements, I'll try to give some hints If time will permit, otherwise please do your refactoring proposals

peppelinux avatar Mar 11 '24 17:03 peppelinux

Not too sure what you meant by "nested if statements" as there was only a single level. I do agree that there was too much logic bundled together and have split it up a bit.

I hope it is somewhat inline with what you were thinking.

GertBurger avatar Mar 13 '24 10:03 GertBurger

sorry for the late @GertBurger

we can open an issue saying that a a further analysis for a code refactor can be made as well.

at the current state the unit tests fails with py3.8 while djangosaml2 needs the support until the official eol of it and the decision of the idpy dev team.

could you propose any workaround in this PR?

peppelinux avatar Apr 11 '24 08:04 peppelinux

ah yes, cache was only introduced in Python 3.9 but it is a very thin wrapper around lru_cache. I've switched to the latter.

GertBurger avatar Apr 11 '24 08:04 GertBurger