🚧 Dynamic config endpoints

This commit is contained in:
Andreas Dinauer 2026-03-14 19:48:19 +01:00
parent 1b91b725d4
commit 25f03d052d

View File

@ -19,17 +19,21 @@ public class OidcConfigurationResource
@ConfigProperty(name = "io.verifoo.http.origin") @ConfigProperty(name = "io.verifoo.http.origin")
String origin; String origin;
@ConfigProperty(name = "quarkus.http.root-path")
String rootPath;
@GET @GET
public OidcConfiguration get(@PathParam("realm-key") String realmKey) public OidcConfiguration get(@PathParam("realm-key") String realmKey)
{ {
RealmEntity realm = realmRepo.findByKey(realmKey); RealmEntity realm = realmRepo.findByKey(realmKey);
if (realm != null) if (realm != null)
{ {
String base = origin + rootPath;
return new OidcConfiguration() return new OidcConfiguration()
.setIssuer(issuerService.getIssuer(realmKey)) .setIssuer(issuerService.getIssuer(realmKey))
.setTokenEndpoint(String.format("%s/api/iam-backend/realms/%s/protocol/openid-connect/token", origin, realmKey)) .setTokenEndpoint(String.format("%s/realms/%s/protocol/openid-connect/token", base, realmKey))
.setAuthorizationEndpoint(String.format("%s/api/iam-backend/realms/%s/protocol/openid-connect/auth", origin, realmKey)) .setAuthorizationEndpoint(String.format("%s/realms/%s/protocol/openid-connect/auth", base, realmKey))
.setJwksURI(String.format("%s/api/iam-backend/realms/%s/protocol/openid-connect/certs", origin, realmKey)); .setJwksURI(String.format("%s/realms/%s/protocol/openid-connect/certs", base, realmKey));
} }
throw new NotFoundException(); throw new NotFoundException();
} }