This is a proof-of-concept sample directory manager plugin to showcase login flow by calling an external API with the following flow.
- The plugin would add an additional login button to the login page in Joget.
- Clicking on the button would retrieve the username and password of the login form and calls the webservice method.
- A API call to external server will be made by calling the authenticateExternal method.
- The payload of the external API is read and used to determine if user is authorized or not. Please see https://github.com/jogetoss/sample-api-authentication/blob/main/src/main/java/org/joget/plugin/marketplace/SampleAPIDirectoryManager.java#L171.
- If the user is authenticated, and the user exists in Joget, then the user is logged in.
- If the user is authenticated, but the user does not exists in Joget, and the user provisioning feature is enabled in the plugin, then a new Joget user will be created and the user is logged in. Please see https://github.com/jogetoss/sample-api-authentication/blob/main/src/main/java/org/joget/plugin/marketplace/SampleAPIDirectoryManager.java#L200.
- If the user is authenticated, but the user does not exists in Joget, and the user provisioning feature is disabled in the plugin, then login fails. Please see https://github.com/jogetoss/sample-api-authentication/blob/main/src/main/java/org/joget/plugin/marketplace/SampleAPIDirectoryManager.java#L236.
Get Started
- Clone this repository and modify the plugin accordingly.
- The external API URL is configured at https://github.com/jogetoss/sample-api-authentication/blob/main/src/main/java/org/joget/plugin/marketplace/SampleAPIDirectoryManager.java#L138.
- Build the plugin and test.
JogetOSS is a community-led team for open source software related to the Joget no-code/low-code application platform. Projects under JogetOSS are community-driven and community-supported. To obtain support, ask questions, get answers and help others, please participate in the Community Q&A.
This project welcomes contributions and suggestions, please open an issue or create a pull request.
Please note that all interactions fall under our Code of Conduct.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
NOTE: This software may depend on other packages that may be licensed under different open source licenses.