JanssenProject / jans

An open source enterprise digital identity platform for CIAM or workforce... Janssen is a distribution of standards-based, developer friendly, components that are engineered to work together in any cloud. #OAuth #OpenID #FIDO
https://docs.jans.io
Apache License 2.0
461 stars 73 forks source link

docs: need instructions on how to remote debug interception scripts using IDE (Eclipse) #3257

Open ossdhaval opened 1 year ago

ossdhaval commented 1 year ago

Describe the bug

As per below feedback, received from @nynymike. @SafinWasi can add more about his experience with this effort.


image


SafinWasi commented 1 year ago

I had added some documentation regarding this here: https://github.com/JanssenProject/jans/blob/main/docs/admin/developer/interception-scripts-debug.md

maduvena commented 1 year ago

Hi @nynymike This is untested currently - https://github.com/maduvena/jans-docs/wiki/Debugging-a-custom-script It is debug option for CE I have used it in my earlier days in Gluu, however I just like the idea of putting print statements in the code and have done so in all these days.

  1. The effort of putting print statement is the same as putting the below breakpoint in code.
    if REMOTE_DEBUG:   
    pydevd.settrace('localhost', port=5678, stdoutToServer=True, stderrToServer=True) 
  2. Another reason is that in a REMOTE debug scenario there is a lag to the extent where it takes few minutes for the debugger to attach. Stepping through breakpoints takes few seconds each time. Connection drops frequently. All in all, it is frustrating.

Same is the case with remote debugging for java programs as well. (Local debugging is very smooth for java)

nynymike commented 1 year ago

I think we need both... isn't the advantage of remote debugging that you can see the object instances, which can help you understand what data is available in the context?

SafinWasi commented 1 year ago

In my experience, the performance can vary because of a number of factors. For example, when I'm running the AS on a local VM, remote debugging through Eclipse is almost as responsive as local debugging. On the other hand, when remote debugging the AS running on a remote server, remote debugging can take several seconds for each round trip on breakpoints, steps and so on. This makes the experience very obtrusive. Regarding remote debugging vs print statements, we may want to observe objects outside the scope of the custom script, in which case we would not be able to use print statements.

ossdhaval commented 1 year ago

So we have two documents, one for remote debugging on VM install (from @maduvena ) and one for CN install (from @SafinWasi). Both are in a draft state and need to be solidified. I'll create two separate issues (tracked under the current issue) to take these to completion.

SafinWasi commented 1 year ago

I think there's a bit of confusion here. I did not write the guide for remote debugging on Cloud Native install. That was by @maduvena. I simply added the steps for enabling remote debugging on the jans-auth Java process. I'm unfamiliar with the CN setup as I always use VM install myself CC @ossdhaval

ossdhaval commented 1 year ago

@SafinWasi Sure. No problems.

Let's do this step-by-step. Let's first get the instructions for debugging on VM installation right. Then we will review instructions for CN. Most steps between VM and CN should be common barring instructions to tackle infra.