SATOSA icon indicating copy to clipboard operation
SATOSA copied to clipboard

Can't use paths in BASE

Open bajnokk opened this issue 2 years ago • 2 comments

I can't make service routing work when base_url contains a path, ie BASE=https://example.com/satosa. (I'm trying with an OIDC frontend and SAML2 backend.)

The problem is that both backends register their endpoints with the base path (ie. satosa/samlbackend/acs/post), but routing.py expects the backend in the first element of context.path.split("/") (routing.py:160). In the example above, the selected backend will be "satosa", which is an invalid backend name.

It doesn't help that ModuleRouter doesn't know the base path, so it can not trim the base path from context.path.

bajnokk avatar Jul 12 '22 13:07 bajnokk

If you change BASE_URL in tests/conftest.py to a value that contains paths, the flow tests also fail.

index 9e7a5e1..6deab65 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -11,7 +11,7 @@ from satosa.state import State
 from .util import create_metadata_from_config_dict
 from .util import generate_cert, write_cert
 
-BASE_URL = "https://test-proxy.com"
+BASE_URL = "https://test-proxy.com/satosa"

...

    >       assert proxied_auth_req.status == "303 See Other"
    E       AssertionError: assert '500 Internal Service Error' == '303 See Other'
    E         - 303 See Other
    E         + 500 Internal Service Error
    
    flows/test_oidc-saml.py:175: AssertionError

bajnokk avatar Jul 12 '22 13:07 bajnokk