Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with allowedIssuers #2578

Open
volkflo opened this issue Aug 9, 2023 · 5 comments
Open

Problems with allowedIssuers #2578

volkflo opened this issue Aug 9, 2023 · 5 comments

Comments

@volkflo
Copy link
Member

volkflo commented Aug 9, 2023

Apiman Version

3.1.2.Final

Apiman Manager Distro

Tomcat

Apiman Gateway Distro

Vert.x

Java Version

11

Operating System

Linux

Are you running Apiman in a container, or on an orchestration platform?

Kubernetes

Describe the bug

Recent changes (759a0d2) cause problems depending on your keycloak endpoint.

If the auth server url contains an path with / (e.g. http://keycloak/my/Cool/Path) the following does not work:

private static String buildIssuerWithRealm(String issuerServer, String realmName) {
try {
URIBuilder builder = new URIBuilder(issuerServer);
List<String> pathSegments = Stream.of(builder.getPath(), "realms", realmName)
.filter(Objects::nonNull)
.collect(Collectors.toList());
URI uri = builder
.setPathSegments(pathSegments)
.build();
return uri.toString();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}

The path is treated as one segment which causes problems in the later URL constructions as the / will be encoded to %2f which causes problems in the discovery.

In addition this feature forces you to use allowedIssuers.
If you do not want this (as you may are only using the internal domain) we should the option in the default config to disabled allowedIssuer checks.

Expected behaviour

Path should be correctly supported.

We could do it something like this, which correctly splits the path by /

List<String> pathSegments = builder.getPathSegments();
         pathSegments.add("realms");
         pathSegments.add(realmName);

In addition the check can be disabled via "validateIssuer": false in the gateway config json.

Actual behaviour

No response

How to Reproduce

No response

Relevant log output

No response

Anything else?

No response

@msavy
Copy link
Member

msavy commented Oct 12, 2023

Did you make a PR for this? Or you just letting me know about it

@volkflo
Copy link
Member Author

volkflo commented Oct 12, 2023

Ehm, that is a good question.
Will check again. I can probably provide a PR.
First, I have to remember if a fixed it already or just disabled the check

@msavy
Copy link
Member

msavy commented Oct 12, 2023

Unless there is a compelling reason, I'm probably not going to do another v3 release, so may not be worth it.

@volkflo
Copy link
Member Author

volkflo commented Oct 12, 2023

Yeah, I guess that is not worth it as this is a very special use case for us.
Not sure how much changes are for Apiman 4 but I guess it would be useful for the V4 release

@msavy
Copy link
Member

msavy commented Oct 12, 2023

In addition to what I've mentioned before re: Apiman 4, I'm focussing on areas as requested by those who financially support the project (i.e. work with Black Parrot Labs to ensure the project can continue), so there will be a fair number of changes both upstream and downstream.

Obviously, there's a heck of a lot to do, especially in combination with my other obligations (and trying not to completely burn myself out).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants