1515from saml2 .extension .ui import NAMESPACE as UI_NAMESPACE
1616from saml2 .metadata import create_metadata_string
1717
18+ from satosa .base import SAMLBaseModule
1819from .base import BackendModule
1920from ..exception import SATOSAAuthenticationError
2021from ..internal_data import (InternalResponse ,
2930logger = logging .getLogger (__name__ )
3031
3132
32- class SAMLBackend (BackendModule ):
33+ class SAMLBackend (BackendModule , SAMLBaseModule ):
3334 """
3435 A saml2 backend module (acting as a SP).
3536 """
@@ -51,7 +52,6 @@ def __init__(self, outgoing, internal_attributes, config, base_url, name):
5152 :param name: name of the plugin
5253 """
5354 super ().__init__ (outgoing , internal_attributes , base_url , name )
54-
5555 sp_config = SPConfig ().load (copy .deepcopy (config ["sp_config" ]), False )
5656 self .sp = Base (sp_config )
5757
@@ -218,7 +218,7 @@ def _translate_response(self, response, state):
218218
219219 internal_resp .user_id = response .get_subject ().text
220220 internal_resp .attributes = self .converter .to_internal (self .attribute_profile , response .ava )
221-
221+
222222 # The SAML response may not include a NameID
223223 try :
224224 internal_resp .name_id = response .assertion .subject .name_id
@@ -260,6 +260,11 @@ def register_endpoints(self):
260260 url_map .append (
261261 ("^%s$" % parsed_endp .path [1 :], self .disco_response ))
262262
263+ if self .expose_entityid_endpoint ():
264+ parsed_entity_id = urlparse (self .sp .config .entityid )
265+ url_map .append (("^{0}" .format (parsed_entity_id .path [1 :]),
266+ self ._metadata_endpoint ))
267+
263268 return url_map
264269
265270 def get_metadata_desc (self ):
@@ -324,7 +329,7 @@ def get_metadata_desc(self):
324329
325330class SAMLInternalResponse (InternalResponse ):
326331 """
327- Like the parent InternalResponse, holds internal representation of
332+ Like the parent InternalResponse, holds internal representation of
328333 service related data, but includes additional details relevant to
329334 SAML interoperability.
330335
0 commit comments