Commit 02027890 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Use correct Base64 dialect when manually parsing JWTs



JWTs use URL-encoded base64 (with - _ instead of + /). This fixes parsing bugs
that would occur when issuing attributes containing certain non-alphanumeric
characters like ~.

Fixes #24.
Co-authored-by: default avatarKoen van Ingen <koenvaningen@gmail.com>
parent 152809f2
......@@ -275,7 +275,7 @@ func JwtDecode(jwt string, body interface{}) error {
if jwtparts == nil || len(jwtparts) < 2 {
return errors.New("Not a JWT")
}
bodybytes, err := base64.RawStdEncoding.DecodeString(jwtparts[1])
bodybytes, err := base64.RawURLEncoding.DecodeString(jwtparts[1])
if err != nil {
return err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment