This repository was archived by the owner on Dec 5, 2025. It is now read-only.
Added support for Bearer token on Webhook class#1784
Open
SDugo wants to merge 2 commits intoTheHive-Project:masterfrom
Open
Added support for Bearer token on Webhook class#1784SDugo wants to merge 2 commits intoTheHive-Project:masterfrom
SDugo wants to merge 2 commits intoTheHive-Project:masterfrom
Conversation
Webhook class now supports the addition of an optional "token". It needs to be declared at the same level that "url" on the application.conf file. If the parameter exists within a webhook definition, its value will be added to an Authorization header. Else, the send() function of the Webhook class won't include this header on the POST request.
An example of configuration on the application.conf would be as follows:
webhooks {
myLocalWebHook {
url = "http://localhost/webhook"
token = "xxxxxxxxxxxxxxxxxx"
}
}
Contributor
|
Hello, thanks @SDugo for the PR. I would add another configuration called |
Added the optional parameter "tokenName", with a "Bearer" default value.
Author
|
Hi @nadouani, I just added the An example of configuration on the application.conf would be as follows: This way, there will be three scenarios:
So, in order to test this solution you should:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Webhook class now supports the addition of an optional "token". It needs to be declared at the same level that "url" on the application.conf file. If the parameter exists within a webhook definition, its value will be added to an Authorization header. Else, the send() function of the Webhook class won't include this header on the POST request.
An example of configuration on the application.conf would be as follows:
So, in order to test this solution you should:
PR_Issue-1690-application.conf.txt
PR_Issue-1690-webhooktest_1.py.txt
PR_Issue-1690-webhooktest_2.py.txt
I am a beginner on Scala, so maybe there is an easier way to achieve this goal. In any case, I tested the code and seems to work on TheHive 3.5.0-1 which is the version that I could download from the build it yourself section.