Module: kamailio
Branch: master
Commit: b4270a57ed10b9fcad56170bf808cc01aaeb7d7f
URL:
https://github.com/kamailio/kamailio/commit/b4270a57ed10b9fcad56170bf808cc0…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2022-11-23T10:46:56+01:00
modules: readme files regenerated - jwt ... [skip ci]
---
Modified: src/modules/jwt/README
---
Diff:
https://github.com/kamailio/kamailio/commit/b4270a57ed10b9fcad56170bf808cc0…
Patch:
https://github.com/kamailio/kamailio/commit/b4270a57ed10b9fcad56170bf808cc0…
---
diff --git a/src/modules/jwt/README b/src/modules/jwt/README
index 4c266bbd01..c4c9610f31 100644
--- a/src/modules/jwt/README
+++ b/src/modules/jwt/README
@@ -30,7 +30,8 @@ Daniel-Constantin Mierla
4. Functions
4.1. jwt_generate(prvkey, alg, claims, [headers])
- 4.2. jwt_verify(pubkey, alg, claims, jwtval)
+ 4.2. jwt_verify(pubkeypath, alg, claims, jwtval)
+ 4.3. jwt_verify_key(pubkeyval, alg, claims, jwtval)
5. Variables
@@ -41,7 +42,8 @@ Daniel-Constantin Mierla
1.1. Set key_mode parameter
1.2. jwt_generate usage
1.3. jwt_verify usage
- 1.4. $jwt(name) usage
+ 1.4. jwt_verify_key usage
+ 1.5. $jwt(name) usage
Chapter 1. Admin Guide
@@ -60,7 +62,8 @@ Chapter 1. Admin Guide
4. Functions
4.1. jwt_generate(prvkey, alg, claims, [headers])
- 4.2. jwt_verify(pubkey, alg, claims, jwtval)
+ 4.2. jwt_verify(pubkeypath, alg, claims, jwtval)
+ 4.3. jwt_verify_key(pubkeyval, alg, claims, jwtval)
5. Variables
@@ -110,7 +113,8 @@ modparam("jwt", "key_mode", 1)
4. Functions
4.1. jwt_generate(prvkey, alg, claims, [headers])
- 4.2. jwt_verify(pubkey, alg, claims, jwtval)
+ 4.2. jwt_verify(pubkeypath, alg, claims, jwtval)
+ 4.3. jwt_verify_key(pubkeyval, alg, claims, jwtval)
4.1. jwt_generate(prvkey, alg, claims, [headers])
@@ -141,12 +145,12 @@ modparam("jwt", "key_mode", 1)
"caller='$fU';callee='$tU';callid='$ci';index=100");
...
-4.2. jwt_verify(pubkey, alg, claims, jwtval)
+4.2. jwt_verify(pubkeypath, alg, claims, jwtval)
Verify the JWT.
The parameters are:
- * pubkey - path to public key
+ * pubkeypath - path to public key file
* alg - the algoritm to build the signature, as supported by the
libjwt (e.g., RS256, HS256, ES256, ...)
* claims - the list of claims to be checked they are in the JWT, in
@@ -166,6 +170,31 @@ modparam("jwt", "key_mode", 1)
}
...
+4.3. jwt_verify_key(pubkeyval, alg, claims, jwtval)
+
+ Verify the JWT.
+
+ The parameters are:
+ * pubkeyval - public key value
+ * alg - the algoritm to build the signature, as supported by the
+ libjwt (e.g., RS256, HS256, ES256, ...)
+ * claims - the list of claims to be checked they are in the JWT, in
+ the format "name1=value1;name2=value2;..." (same as the SIP
+ parameters format, see also the description of claims parameter for
+ jwt_generate()).
+ * jwtval - the value of the JWT to verify
+
+ This function can be used from ANY_ROUTE.
+
+ Example 1.4. jwt_verify_key usage
+...
+ if(!jwt_verify_key("...", "RS256",
+
"caller='$fU';callee='$tU';callid='$ci';index=100",
+ "$var(jwt)") {
+ xwarn("failed to verify jwt\n");
+ }
+...
+
5. Variables
5.1. $jwt(key)
@@ -178,7 +207,7 @@ modparam("jwt", "key_mode", 1)
* val - the value of JWT after a successful jwt_generate().
* status - the status of verification after a failed jwt_verify().
- Example 1.4. $jwt(name) usage
+ Example 1.5. $jwt(name) usage
...
jwt_generate("/path/to/prvkey.pem", "RS256",
"caller='$fU';callee='$tU';callid='$ci';index=100");