Rotem
Sep 08, 2019Nimbostratus
Decode base64 underscore not accepted
Hi ,
Im trying to decode based64 (JWT) using irule , on regular basis this works great .. but right now i found when there is an underscore "_" in payload the request breaks with the following error : "conversion error (line 1) invoked from within....."
I used "cache" in irule to eliminate the error and the service not effected, but there is no data from decoding when found underscore .
(After double checked when eliminating the false character and decoding works perfect)
I used the following (small part of the irule) but this is were i stuck ..
Is there any way to solve it ?
Regards ,
if { [HTTP::header exists Authorization] && [HTTP::header value "Authorization"] contains "Bearer" } {
catch {
set finds [string range [HTTP::header Authorization] [expr {[string first "Bearer " [HTTP::header Authorization]] + 7}] end]
#log local0. "Find String :$finds"
set header [getfield $finds "." 1]
set payload [getfield $finds "." 2]
log local0. "header : $header"
log local0. "payload : $payload"
set HBearer [b64decode $header]
set PBearer [b64decode $payload]
log local0. "Decode Header : $HBearer"
log local0. "Decode Payload : $PBearer"
}
}