Browse code

modules: readme files regenerated - jwt ... [skip ci]

Kamailio Dev authored on 23/11/2022 09:46:56
Showing 1 changed files
... ...
@@ -30,7 +30,8 @@ Daniel-Constantin Mierla
30 30
         4. Functions
31 31
 
32 32
               4.1. jwt_generate(prvkey, alg, claims, [headers])
33
-              4.2. jwt_verify(pubkey, alg, claims, jwtval)
33
+              4.2. jwt_verify(pubkeypath, alg, claims, jwtval)
34
+              4.3. jwt_verify_key(pubkeyval, alg, claims, jwtval)
34 35
 
35 36
         5. Variables
36 37
 
... ...
@@ -41,7 +42,8 @@ Daniel-Constantin Mierla
41 42
    1.1. Set key_mode parameter
42 43
    1.2. jwt_generate usage
43 44
    1.3. jwt_verify usage
44
-   1.4. $jwt(name) usage
45
+   1.4. jwt_verify_key usage
46
+   1.5. $jwt(name) usage
45 47
 
46 48
 Chapter 1. Admin Guide
47 49
 
... ...
@@ -60,7 +62,8 @@ Chapter 1. Admin Guide
60 62
    4. Functions
61 63
 
62 64
         4.1. jwt_generate(prvkey, alg, claims, [headers])
63
-        4.2. jwt_verify(pubkey, alg, claims, jwtval)
65
+        4.2. jwt_verify(pubkeypath, alg, claims, jwtval)
66
+        4.3. jwt_verify_key(pubkeyval, alg, claims, jwtval)
64 67
 
65 68
    5. Variables
66 69
 
... ...
@@ -110,7 +113,8 @@ modparam("jwt", "key_mode", 1)
110 113
 4. Functions
111 114
 
112 115
    4.1. jwt_generate(prvkey, alg, claims, [headers])
113
-   4.2. jwt_verify(pubkey, alg, claims, jwtval)
116
+   4.2. jwt_verify(pubkeypath, alg, claims, jwtval)
117
+   4.3. jwt_verify_key(pubkeyval, alg, claims, jwtval)
114 118
 
115 119
 4.1.  jwt_generate(prvkey, alg, claims, [headers])
116 120
 
... ...
@@ -141,12 +145,12 @@ modparam("jwt", "key_mode", 1)
141 145
         "caller='$fU';callee='$tU';callid='$ci';index=100");
142 146
 ...
143 147
 
144
-4.2.  jwt_verify(pubkey, alg, claims, jwtval)
148
+4.2.  jwt_verify(pubkeypath, alg, claims, jwtval)
145 149
 
146 150
    Verify the JWT.
147 151
 
148 152
    The parameters are:
149
-     * pubkey - path to public key
153
+     * pubkeypath - path to public key file
150 154
      * alg - the algoritm to build the signature, as supported by the
151 155
        libjwt (e.g., RS256, HS256, ES256, ...)
152 156
      * claims - the list of claims to be checked they are in the JWT, in
... ...
@@ -166,6 +170,31 @@ modparam("jwt", "key_mode", 1)
166 170
   }
167 171
 ...
168 172
 
173
+4.3.  jwt_verify_key(pubkeyval, alg, claims, jwtval)
174
+
175
+   Verify the JWT.
176
+
177
+   The parameters are:
178
+     * pubkeyval - public key value
179
+     * alg - the algoritm to build the signature, as supported by the
180
+       libjwt (e.g., RS256, HS256, ES256, ...)
181
+     * claims - the list of claims to be checked they are in the JWT, in
182
+       the format "name1=value1;name2=value2;..." (same as the SIP
183
+       parameters format, see also the description of claims parameter for
184
+       jwt_generate()).
185
+     * jwtval - the value of the JWT to verify
186
+
187
+   This function can be used from ANY_ROUTE.
188
+
189
+   Example 1.4. jwt_verify_key usage
190
+...
191
+  if(!jwt_verify_key("...", "RS256",
192
+         "caller='$fU';callee='$tU';callid='$ci';index=100",
193
+        "$var(jwt)") {
194
+    xwarn("failed to verify jwt\n");
195
+  }
196
+...
197
+
169 198
 5. Variables
170 199
 
171 200
    5.1. $jwt(key)
... ...
@@ -178,7 +207,7 @@ modparam("jwt", "key_mode", 1)
178 207
      * val - the value of JWT after a successful jwt_generate().
179 208
      * status - the status of verification after a failed jwt_verify().
180 209
 
181
-   Example 1.4. $jwt(name) usage
210
+   Example 1.5. $jwt(name) usage
182 211
 ...
183 212
   jwt_generate("/path/to/prvkey.pem", "RS256",
184 213
         "caller='$fU';callee='$tU';callid='$ci';index=100");