providers/saml: optimise excessive queries to user when evaluating attributes
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
69780c67a9
commit
f2b3a2ec91
|
@ -70,13 +70,14 @@ class AssertionProcessor:
|
||||||
"""Get AttributeStatement Element with Attributes from Property Mappings."""
|
"""Get AttributeStatement Element with Attributes from Property Mappings."""
|
||||||
# https://commons.lbl.gov/display/IDMgmt/Attribute+Definitions
|
# https://commons.lbl.gov/display/IDMgmt/Attribute+Definitions
|
||||||
attribute_statement = Element(f"{{{NS_SAML_ASSERTION}}}AttributeStatement")
|
attribute_statement = Element(f"{{{NS_SAML_ASSERTION}}}AttributeStatement")
|
||||||
|
user = self.http_request.user
|
||||||
for mapping in self.provider.property_mappings.all().select_subclasses():
|
for mapping in self.provider.property_mappings.all().select_subclasses():
|
||||||
if not isinstance(mapping, SAMLPropertyMapping):
|
if not isinstance(mapping, SAMLPropertyMapping):
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
mapping: SAMLPropertyMapping
|
mapping: SAMLPropertyMapping
|
||||||
value = mapping.evaluate(
|
value = mapping.evaluate(
|
||||||
user=self.http_request.user,
|
user=user,
|
||||||
request=self.http_request,
|
request=self.http_request,
|
||||||
provider=self.provider,
|
provider=self.provider,
|
||||||
)
|
)
|
||||||
|
|
Reference in New Issue