|
33 | 33 | from ..response import Response |
34 | 34 | from ..response import ServiceError |
35 | 35 | from ..saml_util import make_saml_response |
| 36 | +from ..util import join_paths |
36 | 37 | from satosa.exception import SATOSAError |
37 | 38 | import satosa.util as util |
38 | 39 |
|
@@ -511,17 +512,18 @@ def _register_endpoints(self, providers): |
511 | 512 | """ |
512 | 513 | url_map = [] |
513 | 514 |
|
514 | | - backend_providers = "|".join(providers) |
515 | | - base_path = urlparse(self.base_url).path.lstrip("/") |
516 | | - if base_path: |
517 | | - base_path = base_path + "/" |
| 515 | + backend_providers = "(" + "|".join(providers) + ")" |
518 | 516 | for endp_category in self.endpoints: |
519 | 517 | for binding, endp in self.endpoints[endp_category].items(): |
520 | 518 | endp_path = urlparse(endp).path |
521 | 519 | url_map.append( |
522 | 520 | ( |
523 | | - "^{}({})/{}$".format(base_path, backend_providers, endp_path), |
524 | | - functools.partial(self.handle_authn_request, binding_in=binding) |
| 521 | + "^{}$".format( |
| 522 | + join_paths(self.base_path, backend_providers, endp_path) |
| 523 | + ), |
| 524 | + functools.partial( |
| 525 | + self.handle_authn_request, binding_in=binding |
| 526 | + ), |
525 | 527 | ) |
526 | 528 | ) |
527 | 529 |
|
@@ -769,17 +771,20 @@ def _register_endpoints(self, providers): |
769 | 771 | """ |
770 | 772 | url_map = [] |
771 | 773 |
|
772 | | - backend_providers = "|".join(providers) |
773 | | - base_path = urlparse(self.base_url).path.lstrip("/") |
774 | | - if base_path: |
775 | | - base_path = base_path + "/" |
| 774 | + backend_providers = "(" + "|".join(providers) + ")" |
776 | 775 | for endp_category in self.endpoints: |
777 | 776 | for binding, endp in self.endpoints[endp_category].items(): |
778 | 777 | endp_path = urlparse(endp).path |
779 | 778 | url_map.append( |
780 | 779 | ( |
781 | | - "^{}({})/\S+/{}$".format(base_path, backend_providers, endp_path), |
782 | | - functools.partial(self.handle_authn_request, binding_in=binding) |
| 780 | + "^{}$".format( |
| 781 | + join_paths( |
| 782 | + self.base_path, backend_providers, "\S+", endp_path |
| 783 | + ) |
| 784 | + ), |
| 785 | + functools.partial( |
| 786 | + self.handle_authn_request, binding_in=binding |
| 787 | + ), |
783 | 788 | ) |
784 | 789 | ) |
785 | 790 |
|
|
0 commit comments