org.keycloak.adapters.osgi.PathBasedKeycloakConfigResolver currently splits full request URI by / and simply takes 4th element. E.g.,: http://localhost/a/b/c/d → a.
However we can have requests targeted at different servlet contexts, and sometimes (in OSGi it's not that uncommon) we use default context with empty context path. For example CXF registers its /cxf servlet in default context.
However, having single configuration (resolved by PathBasedKeycloakConfigResolver) for each servlet registered in default context is maybe not a good idea...
My idea is:
- if the context name is non empty, use it (and <context>-keycloak.json)
- if the context name is empty, use the first path segment (like in http://localhost/cxf path, where /cxf servlet was registered in default context) - that in theory doesn't differ from what we have now, but it should be documented.
- in theory, there can be a/b context path, resulting configuration file should be a-b-keycloak.json