<!-- Kamailio Pull Request Template -->
<!-- IMPORTANT: - for detailed contributing guidelines, read: https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md - pull requests must be done to master branch, unless they are backports of fixes from master branch to a stable branch - backports to stable branches must be done with 'git cherry-pick -x ...' - code is contributed under BSD for core and main components (tm, sl, auth, tls) - code is contributed GPLv2 or a compatible license for the other components - GPL code is contributed with OpenSSL licensing exception -->
#### Pre-Submission Checklist <!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply --> <!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above--> <!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list --> - [x] Commit message has the format required by CONTRIBUTING guide - [x] Commits are split per component (core, individual modules, libs, utils, ...) - [x] Each component has a single commit (if not, squash them into one commit) - [ ] No commits to README files for modules (changes must be done to docbook files in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change - [ ] Small bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: <!-- Go over all points below, and after creating the PR, tick the checkboxes that apply --> - [ ] PR should be backported to stable branches - [ ] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description Adding an optional forth parameter to jwt module to add headers.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2971
-- Commit Summary --
* jwt: possibility to add headers when generating jwt
-- File Changes --
M src/modules/jwt/doc/jwt_admin.xml (11) M src/modules/jwt/jwt_mod.c (85)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2971.patch https://github.com/kamailio/kamailio/pull/2971.diff
I see the PR is changing the prototype of ki_jwt_generate() function by adding a new parameter. However that is exported to KEMI and expects the same number of parameters as so far.
You can rename ki_jwt_generate() to ki_jwt_generate_hdrs() and add the new parameter, then re-add ki_jwt_generate() as a wrapper to ki_jwt_generate_hdrs() calling it with the new parameter being NULL.
@RodrigoAS28 pushed 1 commit.
fdb80fdcefc1dca56cc4dcbdb1beeca5d5d273aa noop
@RodrigoAS28 pushed 1 commit.
eb58954dfabb9d0ac7af5fb5544667ab2909682b jwt: possibility to add headers when generating jwt
@miconda commented on this pull request.
@@ -172,18 +175,28 @@ static int jwt_fcache_add(str *key, str *kdata)
* */ static int ki_jwt_generate(sip_msg_t* msg, str *key, str *alg, str *claims) +{ + return ki_jwt_generate_hdrs(msg, key, alg, claims, NULL); +} +
This function has to be moved after `ki_jwt_generate_hdrs()` in order to get it compiled.
@RodrigoAS28 pushed 1 commit.
7400aa89dd5949427a64636d7066e445c544036d jwt: possibility to add headers when generating jwt
@RodrigoAS28 commented on this pull request.
@@ -172,18 +175,28 @@ static int jwt_fcache_add(str *key, str *kdata)
* */ static int ki_jwt_generate(sip_msg_t* msg, str *key, str *alg, str *claims) +{ + return ki_jwt_generate_hdrs(msg, key, alg, claims, NULL); +} +
Thanks for your review @miconda. Fixed.
Still having a issue running it after renaming `ki_jwt_generate` to `ki_jwt_generate_hdrs` though: Ever saw this error? `input in flex scanner failed`
Looking again over the patch, I didn't notice any free of the parsed params and duplicated string for new headers value. It should be done as it is for claims, or am I missing something?
@RodrigoAS28 pushed 1 commit.
89f12d8a7d152347b8976243af1c894f5910d142 dummy
Looking again over the patch, I didn't notice any free of the parsed params and duplicated string for new headers value. It should be done as it is for claims, or am I missing something?
No, you are absolutely right. Please have another look.
Thanks!
Merged #2971 into master.