<div dir="ltr">Hi guys,<div><br></div><div>I'm just setting up an integration test project for our application and I'm wondering what's the best way to bootstrap keycloak within it. </div><div><br></div><div>I'm using arquillian for testing and I'm using the maven-dependency-plugin and maven-resources-plugin to put together a wildfly instance with the keycloak-wildfly-adapter.</div>
<div><br></div><div>So far, that approach works nicely. However, I'm not quite sure yet how to go about </div><div><br></div><div>* importing a realm and </div><div>* creating a bearer/ access token to use in the test cases</div>
<div><br></div><div>One approach would be to deploy the auth-server.war (is there a mvn repository to pull it from?), POST the realm to the respective URL of the admin console and do the authentication the same way (POST <a href="http://localhost:8080/auth/rest/realms/TestRealm/tokens/grants/access">http://localhost:8080/auth/rest/realms/TestRealm/tokens/grants/access</a>).</div>
<div><br></div><div>Alternatively, I suppose I could deploy a small helper war or jar that accesses the core services of keycloak to import the realm and create test access tokens (some convenience method like "createLogin()" in a test utility that is deployed with shrink wrap maybe).</div>
<div><br></div><div>Which option do you recommend or is there a third one that I'm missing?</div><div><br></div><div>Cheers,</div><div>Nils</div></div>