Skip to content
This repository has been archived by the owner on Feb 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #141 from hasinthaindrajee/master
Browse files Browse the repository at this point in the history
Use Base64Url encoding instead of Base64 encoding for jwts
  • Loading branch information
nadundesilva committed Aug 26, 2019
2 parents 74adca1 + 3904830 commit 86cab2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/api/idp/tokens.bal
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function extractSubject(string jwt) returns error | string{
log:printDebug("Decoding jwt token body :" + jwt);
string[] split_string = jwt.split("\\."); // Split the string
string base64EncodedBody = split_string[1]; // Payload part
byte[] bodyBytes = check encoding:decodeBase64(base64EncodedBody);
byte[] bodyBytes = check encoding:decodeBase64Url(base64EncodedBody);
string body = encoding:byteArrayToString(bodyBytes, encoding = "utf-8");
log:printDebug("Decoded jwt token body :" + body);
io:StringReader sr = new(body, encoding = "UTF-8");
Expand Down

0 comments on commit 86cab2b

Please sign in to comment.