The url safe base64 encoding function needs to be fixed to remove "=" padding

Created on 19 August 2024, 8 months ago
Updated 20 August 2024, 8 months ago

Problem

While implementing openidconnect authentication it was found that the jwk response of the route /oauth/jwk was giving an invalid url encoded base64 keys. the "=" padding is not needed in url encoded base64 still was being added to the response. This can be fixed by updating oauth2_server_base64url_decode() function in .module file as below.

Steps to reproduce

While trying to authenticate against any open id connect client you would see below error
"unmarshal json invalid base 64"

Proposed resolution

Update oauth2_server_base64url_decode()

function oauth2_server_base64url_decode($data) {
  return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India tdnshah

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024