mirror of https://github.com/MISP/MISP
Oidc: allow custom username property
Allow a custom field `username_property` in Config to not force `email`. The default stays `email`.pull/9664/head
parent
b8ef22754f
commit
4defa600a7
|
@ -27,7 +27,8 @@ class Oidc
|
|||
|
||||
$claims = $oidc->getVerifiedClaims();
|
||||
|
||||
$mispUsername = $claims->email ?? $oidc->requestUserInfo('email');
|
||||
$usernameProperty = $this->getConfig('username_property', 'email');
|
||||
$mispUsername = $claims->$usernameProperty ?? $oidc->requestUserInfo($usernameProperty);
|
||||
if (empty($mispUsername)) {
|
||||
$sub = $claims->sub ?? 'UNKNOWN';
|
||||
throw new Exception("OIDC user $sub doesn't have email address, that is required by MISP.");
|
||||
|
|
Loading…
Reference in New Issue