From a0b2ef072220fce222e3ed9e41bfe04629526855 Mon Sep 17 00:00:00 2001 From: Lai Wei Date: Tue, 16 Jan 2024 10:02:35 +0000 Subject: [PATCH] Check if "bindingusernameclaim" configuration exists --- binding_username_claim.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/binding_username_claim.php b/binding_username_claim.php index bf7a3bd..1aa7bcc 100644 --- a/binding_username_claim.php +++ b/binding_username_claim.php @@ -49,8 +49,12 @@ $formdata = []; $predefinedbindingclaims = ['auto', 'preferred_username', 'email', 'upn', 'unique_name', 'sub', 'oid', 'samaccountname']; $oidcconfig = get_config('auth_oidc'); - -if (!$oidcconfig->bindingusernameclaim) { +if (!isset($oidcconfig->bindingusernameclaim)) { + // bindingusernameclaim is not set, set default value. + $formdata['bindingusernameclaim'] = 'auto'; + $formdata['customclaimname'] = ''; + set_config('bindingusernameclaim', 'auto', 'auth_oidc'); +} else if(!$oidcconfig->bindingusernameclaim) { $formdata['bindingusernameclaim'] = 'auto'; $formdata['customclaimname'] = ''; } else if (in_array($oidcconfig->bindingusernameclaim, $predefinedbindingclaims)) {