Custom Plugin

Confluence User - 04 Dec, 2024

I'm trying to build dx7 sso custom plugin Single Sign On - SSO - Knowledge Base for DX 7 - Joget | COMMUNITY.

  1. Do we able to run and debug in our local env? I'm using visual code.
  2. The java version need to stay in java8 or can above? and the JRE ?
  3. How i know the url to call the webserivce? tried  http://localhost:8080/jw/web/json/plugin/org.joget.abcsso.abc-sso/service?_username=admin at browser console, it return me 'Uncaught SyntaxError: Unexpected end of input'


Let me what info is needed? 

plugins;webservice;dx7

9


04 Dec, 2024
confluenceUser
1
confluenceUser

Hi Vicky, I would suggest using IntelliJ IDEA or Eclipse instead of VS Code as these IDEs offer better Java debugging and Maven integration and yes you can attach your debugger to the listening port of your tomcat instance and debug your code. See Building from Source for more information.

The webservice URL format is: {Context Path}/web/json/app/{App Id}/{App Version}/plugin/{Plugin Class Name}/service , For syntax errors, implement proper error handling: Add try-catch blocks in your code and use LogUtil to track the execution and check Tomcat logs for error details. Refer: LogUtil


Additionally, you can refer the below existing plugins which are similar to what you are trying to implement:

https://github.com/jogetoss/sample-api-authentication

https://github.com/jogetoss/sp-saml-directory-manager

https://github.com/jogetoss/openid-connect-authentication

https://github.com/jogetoss/uae-pass-directory-manager


Hope this helps!

04 Dec, 2024
confluenceUser
confluenceUser

Hello Varrna,

Thank for the reply. The url related question, i cannot the plugin to any apps, that why i using http://localhost:8080/jw/web/json/plugin/org.joget.abcsso.abc-sso/service?_username=admin to do testing. i put this url in F12 console tab, am i acting correct ?

my code is very simple for now, but i not able to see any log in System log.


can you help me on this? Many thanks.

04 Dec, 2024
confluenceUser
confluenceUser

Hi Vicky! Here's how to test your plugin:

  1. Build and deploy:
    • Run "mvn clean install" to generate your jar file
    • Upload the jar to your Joget instance
  2. Testing options:
    • Use Postman (recommended)
    • Test directly in browser by pasting the webservice URL without any username parameters
    • No need to use F12 console tab

Please note:

  • Web service URL has no default authentication
  • Verify your plugin is properly registered in Activator.java
  • Ensure PluginWebSupport is implemented in your Plugin class

Let me know if you need help with any of these steps!

04 Dec, 2024
confluenceUser
confluenceUser

Hi Varnaa,
I tried to call via web browser and postman, i got 404 as below:


Can you help to check on my Activator:


My Sample Class:


which part i need to change?

04 Dec, 2024
confluenceUser
confluenceUser

404 error suggests Joget is not able to find the requested API. Can you check whether you have enabled whitelisting? Settings → General Settings and set the below fields as * 

As for your Activator and code it looks fine.

04 Dec, 2024
confluenceUser
confluenceUser

my whitelist is same as yours.

04 Dec, 2024
confluenceUser
confluenceUser

I just realised the URL is wrong. you didnt include the class name. it should be /packagename/className/service

04 Dec, 2024
confluenceUser
confluenceUser
04 Dec, 2024
confluenceUser
confluenceUser

Glad it worked! Kindly Accept the answer :) 

Feel free to reach out if you have further questions. 

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print