@@ -700,6 +700,7 @@ class SAMLVirtualCoFrontend(SAMLFrontend):
700
700
"""
701
701
KEY_CO = 'collaborative_organizations'
702
702
KEY_CO_NAME = 'co_name'
703
+ KEY_CO_ENTITY_ID = 'co_entity_id'
703
704
KEY_CO_ATTRIBUTES = 'co_static_saml_attributes'
704
705
KEY_CONTACT_PERSON = 'contact_person'
705
706
KEY_ENCODEABLE_NAME = 'encodeable_name'
@@ -770,6 +771,8 @@ def _create_state_data(self, context, resp_args, relay_state):
770
771
"""
771
772
state = super ()._create_state_data (context , resp_args , relay_state )
772
773
state [self .KEY_CO_NAME ] = context .get_decoration (self .KEY_CO_NAME )
774
+ state [self .KEY_CO_ENTITY_ID ] = context .get_decoration (
775
+ self .KEY_CO_ENTITY_ID )
773
776
774
777
return state
775
778
@@ -869,19 +872,22 @@ def _add_endpoints_to_config(self, config, co_name, backend_name):
869
872
870
873
return config
871
874
872
- def _add_entity_id (self , config , co_name ):
875
+ def _add_entity_id (self , context , config , co_name ):
873
876
"""
874
877
Use the CO name to construct the entity ID for the virtual IdP
875
- for the CO.
878
+ for the CO and add it to the config. Also add it to the
879
+ context.
876
880
877
881
The entity ID has the form
878
882
879
883
{base_entity_id}/{co_name}
880
884
885
+ :type context: The current context
881
886
:type config: satosa.satosa_config.SATOSAConfig
882
887
:type co_name: str
883
888
:rtype: satosa.satosa_config.SATOSAConfig
884
889
890
+ :param context:
885
891
:param config: satosa proxy config
886
892
:param co_name: CO name
887
893
@@ -890,6 +896,7 @@ def _add_entity_id(self, config, co_name):
890
896
base_entity_id = config ['entityid' ]
891
897
co_entity_id = "{}/{}" .format (base_entity_id , quote_plus (co_name ))
892
898
config ['entityid' ] = co_entity_id
899
+ context .decorate (self .KEY_CO_ENTITY_ID , co_entity_id )
893
900
894
901
return config
895
902
@@ -910,7 +917,8 @@ def _overlay_for_saml_metadata(self, config, co_name):
910
917
"""
911
918
all_co_configs = self .config [self .KEY_CO ]
912
919
co_config = next (
913
- item for item in all_co_configs if item [self .KEY_ENCODEABLE_NAME ] == co_name
920
+ item for item in all_co_configs
921
+ if item [self .KEY_ENCODEABLE_NAME ] == co_name
914
922
)
915
923
916
924
key = self .KEY_ORGANIZATION
@@ -974,7 +982,7 @@ def _create_co_virtual_idp(self, context):
974
982
idp_config = self ._add_endpoints_to_config (idp_config ,
975
983
co_name ,
976
984
backend_name )
977
- idp_config = self ._add_entity_id (idp_config , co_name )
985
+ idp_config = self ._add_entity_id (context , idp_config , co_name )
978
986
979
987
# Use the overwritten IdP config to generate a pysaml2 config object
980
988
# and from it a server object.
0 commit comments