dasniko / testcontainers-keycloak

A Testcontainer implementation for Keycloak IAM & SSO.
Apache License 2.0
341 stars 53 forks source link

How to adjust "auth-server-url" at runtime #11

Closed NiklasA closed 3 years ago

NiklasA commented 3 years ago

Hi @dasniko,

I really like your Keycloak Testcontainer. Is there an easy way to adjust the "keycloak.auth-server-url" property in my "application.yaml" in my integration tests at runtime? Because otherwise, my application does not know how it could validate e.g. a given access token.

My workaround was to customize your Java class "KeycloakContainer" and change this class to extend FixedHostPortGenericContainer instead of GenericContainer. However, it seems to me that I should not be the only one (hopefully ;-) with this problem.

My current project setup:

Thank you in advance.

BR Niklas

dasniko commented 3 years ago

Hi Niklas, Happy to hear that you like the Keycloak Testcontainer.

So, your question is about how to configure your application framework and its testing resources, not about Keycloak Testcontainers, as this is a general requirement when using Testcontainers, nothing special with the Keycloak Testcontainer (e.g when using DB testcontainers, you also have to adjust host/port/credentials somehow).

For Spring based applications, I already answered this in this comment. It‘s always a good thing to know the used stack and its testing possibilities. 😉

dasniko commented 3 years ago

Closing this issue as there is no feedback.