MINOR: sample: add ub64dec and ub64enc converters
authorMoemen MHEDHBI <mmhedhbi@haproxy.com>
Thu, 1 Apr 2021 18:53:59 +0000 (20:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 13 Apr 2021 15:28:13 +0000 (17:28 +0200)
commit92f7d43c5de669208d35145aea5a4fbafb748c49
treec04dd138ba5fb59282b85f804288a1371f2a929f
parentb28430591d18f7fda5bac2e0ea590b3a34f04601
MINOR: sample: add ub64dec and ub64enc converters

ub64dec and ub64enc are the base64url equivalent of b64dec and base64
converters. base64url encoding is the "URL and Filename Safe Alphabet"
variant of base64 encoding. It is also used in in JWT (JSON Web Token)
standard.
RFC1421 mention in base64.c file is deprecated so it was replaced with
RFC4648 to which existing converters, base64/b64dec, still apply.

Example:
  HAProxy:
    http-request return content-type text/plain lf-string %[req.hdr(Authorization),word(2,.),ub64dec]
  Client:
    Token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiZm9vIiwia2V5IjoiY2hhZTZBaFhhaTZlIn0.5VsVj7mdxVvo1wP5c0dVHnr-S_khnIdFkThqvwukmdg
    $ curl -H "Authorization: Bearer ${TOKEN}" http://haproxy.local
    {"user":"foo","key":"chae6AhXai6e"}
doc/configuration.txt
include/haproxy/base64.h
reg-tests/sample_fetches/ubase64.vtc [new file with mode: 0644]
src/base64.c
src/sample.c