Skip to content

Commit 07b4fc0

Browse files
authored
Merge pull request #227 from digital2real/add-azure-adfs-b2c-userflow-support
Add support for MS Azure Active Directory B2C user flows
2 parents 2e765de + 8509ec2 commit 07b4fc0

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77
## [Unreleased]
88

99
### Added
10-
*
10+
* Add support for MS Azure Active Directory B2C user flows
1111

1212
### Changed
1313
* Fix at_hash verification #200

src/OpenIDConnectClient.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ class OpenIDConnectClient
184184
*/
185185
private $wellKnown = false;
186186

187+
/**
188+
* @var mixed holds well-known opendid configuration parameters, like policy for MS Azure AD B2C User Flow
189+
* @see https://docs.microsoft.com/en-us/azure/active-directory-b2c/user-flow-overview
190+
*/
191+
private $wellKnownConfigParameters = array();
192+
187193
/**
188194
* @var int timeout (seconds)
189195
*/
@@ -500,6 +506,9 @@ private function getWellKnownConfigValue($param, $default = null) {
500506
// This is also known as auto "discovery"
501507
if(!$this->wellKnown) {
502508
$well_known_config_url = rtrim($this->getProviderURL(), '/') . '/.well-known/openid-configuration';
509+
if (count($this->wellKnownConfigParameters) > 0){
510+
$well_known_config_url .= '?' . http_build_query($this->wellKnownConfigParameters) ;
511+
}
503512
$this->wellKnown = json_decode($this->fetchURL($well_known_config_url));
504513
}
505514

@@ -520,6 +529,16 @@ private function getWellKnownConfigValue($param, $default = null) {
520529
throw new OpenIDConnectClientException("The provider {$param} could not be fetched. Make sure your provider has a well known configuration available.");
521530
}
522531

532+
/**
533+
* Set optionnal parameters for .well-known/openid-configuration
534+
*
535+
* @param string $param
536+
*
537+
*/
538+
public function setWellKnownConfigParameters(array $params = []){
539+
$this->wellKnownConfigParameters=$params;
540+
}
541+
523542

524543
/**
525544
* @param string $url Sets redirect URL for auth flow

0 commit comments

Comments
 (0)