<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body><div>Hi,</div><div><br></div><div>I've recently had an experience of developing/deploying/debugging a KeyCloak extension, which includes, among other things, a custom REST endpoint.</div><div><br></div><div>For me, the following workflow did the thing. It is assumed that you've downloaded and unpacked a binary KeyCloak distro:</div><div><br></div><div>1) clone a KeyCloak Git repository. There is no need to build KeyCloak, since modules can be pretty easily deployed to an existing instance. You will need sources for debugging only. Use the branch/tag that corresponds to the binary version you've downloaded;</div><div>2) open KeyCloak source as a Maven project(s) in your IDE (I use NetBeans);</div><div>3) build and deploy your module. Until last week, I used to copy module JAR to the target directory upon each build, but then I've stumbled upon the recent KeyCloak blog <a href="http://blog.keycloak.org/2016/07/loading-providers-and-themes-from-maven.html">post</a>. It's very convenient, especially for development/testing environments, to have extension modules deployed right from the Maven repo;</div><div>4) start KeyCloak with bin/standalone.sh --debug</div><div>5) attach your IDE's debugger to localhost:8787 using dt_socket transport (it could be also called "SocketAttach connector");</div><div>6) set up some breakpoints, invoke your REST service to hit a breakpoint, and voilà!</div><div><br></div><div>As for documenting development process, I completely share your point. Ideally, we should have a detailed walkthrough tutorial for writing complete KeyCloak extensions. At the moment all we've got is a chapter in the docs and some scattered examples in the repo.</div><div><br></div><div>At the same time, what I've been developing recently is a full-featured, complete extension that includes:</div><div>- custom JPA entity;</div><div>- custom REST resource;</div><div>- custom authenticator;</div><div>- custom GUI to manage this all;</div><div>- code that sets up custom roles and authentication workflows.</div><div><br></div><div>I think I could convert my experience into such a tutorial. I'll elaborate on this in one of my next postings to this ML; I could put you on CC if you wish, so that you don't miss it.</div><div><br></div><div>Cheers,</div><div>Dmitry</div><div><br></div><blockquote type="cite"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Hello,</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">I’m trying to implement a custom made REST endpoint in Keycloak following the documentation in <a href="https://keycloak.gitbooks.io/server-developer-guide/content/v/2.0/topics/extensions.html">https://keycloak.gitbooks.io/server-developer-guide/content/v/2.0/topics/extensions.html</a></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">As I see I have to compile the module and deploy it to Keycloak. So, is there any easy way to deploy/debug into a Keycloak instance?</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">As I see, the documentation in the Github repo recommends to use standalone.sh to start the server and I can add the debug flag. But, that doesn’t exist in the repository. Any guidance in this?</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Also, any maven commands to fast deploy the module into the Keycloak instance?</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">At the moment I’ve only found that I should run Keycloak in debug mode and then attach to port 8787, but well, first I need to find how to run it from the source...</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">I could even help to extend the documentation with some steps in order to setup an easy dev setup, so people can contribute easier in exchange of the help :)</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Thanks a lot!</div><div class="bloop_container"><div class="bloop_frame"> </div></div><br><div class="bloop_sign" id="bloop_sign_1468858323238762752"><div style="font-family:helvetica,arial;font-size:13px">— </div><div style="font-family:helvetica,arial;font-size:13px">Best Regards, </div><div style="font-family:helvetica,arial;font-size:13px"><br>Erik Berdonces Bonelo<br></div></div><pre>_______________________________________________
keycloak-dev mailing list
<a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a></pre></blockquote></body></html>