Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(admin-ui): execute custom business logic using web hook #1503

Closed
duttarnab opened this issue Dec 13, 2023 · 4 comments · Fixed by #1530
Closed

feat(admin-ui): execute custom business logic using web hook #1503

duttarnab opened this issue Dec 13, 2023 · 4 comments · Fixed by #1530
Assignees
Labels
comp-admin-ui Component affected by issue or PR enhancement New feature or request kind-feature Issue or PR is a new feature request

Comments

@duttarnab
Copy link
Contributor

duttarnab commented Dec 13, 2023

We need a feature in Admin UI to exceute the custom business logic by calling webhook url.

image

Points discussed

  • There was a conversation on Jans about how to execute extra business logic in the Admin UI
  • I have an idea... what if we allow the Admin to create Webhooks.
  • We could add this as an optional configuration in the Admin UI properties...
  • For example, you could set this for any create / update / delete for a user...
  • This would enable the AdminUI to call external components without having to implement a new interception script...
  • Ideally, we'd have one place where admins coulds manage webhooks.
  • And then in the UserForm, you would select the webhook to run based on the Webhook Name
  • Don't we already have an approve and Log function in the Admin UI? Does this approve / admin workflow also apply to user edits? (It should...)
  • Then we could have a workflow where you approve the change, make an audit log for why it happened, and then we run a webhook to authorize.

Sequence diagram

title Webhook flow

actor User
database Jans DB

User<->Admin UI: login
User->Admin UI: Register webhook\n (URL, HTTP methods etc.)
Admin UI->Jans Config Api: call api to save webhook details\n in Admin UI configuration
Jans Config Api->Jans DB: webhook details
Jans DB-> Jans Config Api:
Jans Config Api->Admin UI: response
alt webhook call flow
User->Admin UI: edit user details
Admin UI->User: show audit log dialog
User-> Admin UI: enter comments and submit
Admin UI->Jans Config Api: /auditlog
Jans Config Api<->Jans DB: fetches webhook details
Jans Config Api->3rd party server: triggers webhook url
alt success
3rd party server->Jans Config Api: response
Jans Config Api->Jans Config Api: performs user update and audit log
Jans Config Api->Admin UI: success response
else failure
3rd party server->Jans Config Api: response
Jans Config Api->Jans Config Api: rejects user update
Jans Config Api->Admin UI: failure response
end
end
@duttarnab duttarnab added enhancement New feature or request comp-admin-ui Component affected by issue or PR kind-feature Issue or PR is a new feature request labels Dec 13, 2023
@duttarnab duttarnab self-assigned this Dec 13, 2023
@duttarnab
Copy link
Contributor Author

image

@duttarnab
Copy link
Contributor Author

duttarnab commented Dec 15, 2023

@duttarnab
Copy link
Contributor Author

duttarnab commented Dec 15, 2023

Screen Design

image

@duttarnab
Copy link
Contributor Author

  1. The admin can add a new webhook . POST /admin-ui/webhook.
  2. The admin can edit an existing webhook. PUT /admin-ui/webhook.
  3. The admin can delete an existing webhook. DELETE /admin-ui/webhook.
  4. On opening a webhook details, the admin would be able to see the admin-ui features already to mapped to the webhook. On opening it will call GET /admin-ui/webhook/features/{webhookId} to get all the features mapped.
  5. On submitting the form of any Admin UI feature it will first show a modal listing the enabled webhooks mapped to it.
    (WIll develop and update API). On accepting the Admin UI will trigger all the webhooks and show the result. --- GET /admin-ui/webhook/trigger/{featureId}
    If all webhooks are successful then it will call the audit endpoint to log the result.
    At the end it will display comments dialog to submit the form.
  6. In case there is not webhooks mapped to the feature then it will skip showing webhook dialog.

jv18creator added a commit that referenced this issue Jan 3, 2024
Signed-off-by: Jeet Viramgama <jviramgama5@gmail.com>
jv18creator added a commit that referenced this issue Jan 8, 2024
Signed-off-by: Jeet Viramgama <jviramgama5@gmail.com>
duttarnab added a commit that referenced this issue Jan 17, 2024
feat(admin-ui): execute custom business logic using web hook #1503
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-admin-ui Component affected by issue or PR enhancement New feature or request kind-feature Issue or PR is a new feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant