[keycloak-dev] Debugging with an IDE configuration
Dmitry Telegin
mitya at cargosoft.ru
Mon Jul 18 13:55:01 EDT 2016
Hi,
I've recently had an experience of developing/deploying/debugging a
KeyCloak extension, which includes, among other things, a custom REST
endpoint.
For me, the following workflow did the thing. It is assumed that you've
downloaded and unpacked a binary KeyCloak distro:
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;
2) open KeyCloak source as a Maven project(s) in your IDE (I use
NetBeans);
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 post. It's very convenient, especially
for development/testing environments, to have extension modules
deployed right from the Maven repo;
4) start KeyCloak with bin/standalone.sh --debug
5) attach your IDE's debugger to localhost:8787 using dt_socket
transport (it could be also called "SocketAttach connector");
6) set up some breakpoints, invoke your REST service to hit a
breakpoint, and voilà!
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.
At the same time, what I've been developing recently is a full-
featured, complete extension that includes:
- custom JPA entity;
- custom REST resource;
- custom authenticator;
- custom GUI to manage this all;
- code that sets up custom roles and authentication workflows.
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.
Cheers,
Dmitry
> Hello,
>
> > > I’m trying to implement a custom made REST endpoint in Keycloak
following the documentation in https://keycloak.gitbooks.io/server-de
veloper-guide/content/v/2.0/topics/extensions.html
> > 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?
>
> > > 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?
> > Also, any maven commands to fast deploy the module into the Keycloak
instance?
>
> > > 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...
>
> > > 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 :)
>
> Thanks a lot!
>
>
>
> —
> Best Regards,
>
> Erik Berdonces Bonelo
>
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-dev/attachments/20160718/bc78824b/attachment.html
More information about the keycloak-dev
mailing list