@@ -69,8 +69,10 @@ protected function definition() {
6969 $ authmethodoptions = [
7070 AUTH_OIDC_AUTH_METHOD_SECRET => get_string ('auth_method_secret ' , 'auth_oidc ' ),
7171 ];
72- if (isset ($ this ->_customdata ['oidcconfig ' ]->idptype ) &&
73- $ this ->_customdata ['oidcconfig ' ]->idptype == AUTH_OIDC_IDP_TYPE_MICROSOFT_IDENTITY_PLATFORM ) {
72+ if (
73+ isset ($ this ->_customdata ['oidcconfig ' ]->idptype ) &&
74+ $ this ->_customdata ['oidcconfig ' ]->idptype == AUTH_OIDC_IDP_TYPE_MICROSOFT_IDENTITY_PLATFORM
75+ ) {
7476 $ authmethodoptions [AUTH_OIDC_AUTH_METHOD_CERTIFICATE ] = get_string ('auth_method_certificate ' , 'auth_oidc ' );
7577 }
7678 $ mform ->addElement ('select ' , 'clientauthmethod ' , auth_oidc_config_name_in_form ('clientauthmethod ' ), $ authmethodoptions );
@@ -93,16 +95,24 @@ protected function definition() {
9395 $ mform ->addElement ('static ' , 'clientcertsource_help ' , '' , get_string ('clientcertsource_help ' , 'auth_oidc ' ));
9496
9597 // Certificate private key.
96- $ mform ->addElement ('textarea ' , 'clientprivatekey ' , auth_oidc_config_name_in_form ('clientprivatekey ' ),
97- ['rows ' => 10 , 'cols ' => 80 , 'class ' => 'cert_textarea ' ]);
98+ $ mform ->addElement (
99+ 'textarea ' ,
100+ 'clientprivatekey ' ,
101+ auth_oidc_config_name_in_form ('clientprivatekey ' ),
102+ ['rows ' => 10 , 'cols ' => 80 , 'class ' => 'cert_textarea ' ]
103+ );
98104 $ mform ->setType ('clientprivatekey ' , PARAM_TEXT );
99105 $ mform ->disabledIf ('clientprivatekey ' , 'clientauthmethod ' , 'neq ' , AUTH_OIDC_AUTH_METHOD_CERTIFICATE );
100106 $ mform ->disabledIf ('clientprivatekey ' , 'clientcertsource ' , 'neq ' , AUTH_OIDC_AUTH_CERT_SOURCE_TEXT );
101107 $ mform ->addElement ('static ' , 'clientprivatekey_help ' , '' , get_string ('clientprivatekey_help ' , 'auth_oidc ' ));
102108
103109 // Certificate certificate.
104- $ mform ->addElement ('textarea ' , 'clientcert ' , auth_oidc_config_name_in_form ('clientcert ' ),
105- ['rows ' => 10 , 'cols ' => 80 , 'class ' => 'cert_textarea ' ]);
110+ $ mform ->addElement (
111+ 'textarea ' ,
112+ 'clientcert ' ,
113+ auth_oidc_config_name_in_form ('clientcert ' ),
114+ ['rows ' => 10 , 'cols ' => 80 , 'class ' => 'cert_textarea ' ]
115+ );
106116 $ mform ->setType ('clientcert ' , PARAM_TEXT );
107117 $ mform ->disabledIf ('clientcert ' , 'clientauthmethod ' , 'neq ' , AUTH_OIDC_AUTH_METHOD_CERTIFICATE );
108118 $ mform ->disabledIf ('clientcert ' , 'clientcertsource ' , 'neq ' , AUTH_OIDC_AUTH_CERT_SOURCE_TEXT );
@@ -164,12 +174,19 @@ protected function definition() {
164174
165175 // Secret expiry notifications recipients.
166176 if (auth_oidc_is_local_365_installed ()) {
167- $ mform ->addElement ('header ' , 'secretexpirynotification ' ,
168- get_string ('settings_section_secret_expiry_notification ' , 'auth_oidc ' ));
177+ $ mform ->addElement (
178+ 'header ' ,
179+ 'secretexpirynotification ' ,
180+ get_string ('settings_section_secret_expiry_notification ' , 'auth_oidc ' )
181+ );
169182 $ mform ->setExpanded ('secretexpirynotification ' );
170183
171- $ mform ->addElement ('text ' , 'secretexpiryrecipients ' , auth_oidc_config_name_in_form ('secretexpiryrecipients ' ),
172- ['size ' => 256 ]);
184+ $ mform ->addElement (
185+ 'text ' ,
186+ 'secretexpiryrecipients ' ,
187+ auth_oidc_config_name_in_form ('secretexpiryrecipients ' ),
188+ ['size ' => 256 ]
189+ );
173190 $ mform ->setType ('secretexpiryrecipients ' , PARAM_TEXT );
174191 $ mform ->disabledIf ('secretexpiryrecipients ' , 'clientauthmethod ' , 'neq ' , AUTH_OIDC_AUTH_METHOD_SECRET );
175192 $ mform ->disabledIf ('secretexpiryrecipients ' , 'idptype ' , 'eq ' , AUTH_OIDC_IDP_TYPE_OTHER );
@@ -254,16 +271,22 @@ public function validation($data, $files) {
254271 }
255272
256273 // If "certificate" authentication method is used, ensure tenant specific endpoints are used.
257- if ($ data ['idptype ' ] == AUTH_OIDC_IDP_TYPE_MICROSOFT_IDENTITY_PLATFORM &&
258- $ data ['clientauthmethod ' ] == AUTH_OIDC_AUTH_METHOD_CERTIFICATE ) {
259- if (strpos ($ data ['authendpoint ' ], '/common/ ' ) !== false ||
274+ if (
275+ $ data ['idptype ' ] == AUTH_OIDC_IDP_TYPE_MICROSOFT_IDENTITY_PLATFORM &&
276+ $ data ['clientauthmethod ' ] == AUTH_OIDC_AUTH_METHOD_CERTIFICATE
277+ ) {
278+ if (
279+ strpos ($ data ['authendpoint ' ], '/common/ ' ) !== false ||
260280 strpos ($ data ['authendpoint ' ], '/organizations/ ' ) !== false ||
261- strpos ($ data ['authendpoint ' ], '/consumers/ ' ) !== false ) {
281+ strpos ($ data ['authendpoint ' ], '/consumers/ ' ) !== false
282+ ) {
262283 $ errors ['authendpoint ' ] = get_string ('error_tenant_specific_endpoint_required ' , 'auth_oidc ' );
263284 }
264- if (strpos ($ data ['tokenendpoint ' ], '/common/ ' ) !== false ||
285+ if (
286+ strpos ($ data ['tokenendpoint ' ], '/common/ ' ) !== false ||
265287 strpos ($ data ['tokenendpoint ' ], '/organizations/ ' ) !== false ||
266- strpos ($ data ['tokenendpoint ' ], '/consumers/ ' ) !== false ) {
288+ strpos ($ data ['tokenendpoint ' ], '/consumers/ ' ) !== false
289+ ) {
267290 $ errors ['tokenendpoint ' ] = get_string ('error_tenant_specific_endpoint_required ' , 'auth_oidc ' );
268291 }
269292 }
0 commit comments