Azure AD B2C version 2 check fails with query parameter in URL

Created on 28 February 2025, 10 days ago

Problem/Motivation

The openid_connect_windows_aad module determines whether Azure supports B2C version 2 using the following check:

$this->isB2Cv2 = str_contains($endpoint, '.b2clogin.com/') && str_ends_with($endpoint, '/oauth2/v2.0/authorize');

However, in our implementation, the endpoint includes a mandatory query parameter:

http://foo.b2clogin.com/bar/oauth2/v2.0/authorize?p=B2C_FOO_SIGN_UP_SIGN_IN

Since the current logic uses str_ends_with() on the full string, it incorrectly fails when a query parameter is present.

Proposed resolution

$endpoint_parsed = parse_url($endpoint);
$this->isB2Cv2 = str_ends_with($endpoint_parsed['host'], '.b2clogin.com') && str_ends_with($endpoint_parsed['path'], '/oauth2/v2.0/authorize');
🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇳🇱Netherlands arjenk

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