@@ -146,57 +146,57 @@ function auth_saml2_get_sp_metadata($baseurl = '') {
146146 $ metaArray20 ['NameIDFormat ' ] = $ format ;
147147 }
148148
149- $ name = $ spconfig ->getLocalizedString ('name ' , NULL );
150- $ attributes = $ spconfig ->getArray ('attributes ' , array ());
149+ $ name = $ spconfig ->getOptionalLocalizedString ('name ' , NULL );
150+ $ attributes = $ spconfig ->getOptionalArray ('attributes ' , array ());
151151
152152 if ($ name !== NULL && !empty ($ attributes )) {
153153 $ metaArray20 ['name ' ] = $ name ;
154154 $ metaArray20 ['attributes ' ] = $ attributes ;
155- $ metaArray20 ['attributes.required ' ] = $ spconfig ->getArray ('attributes.required ' , array ());
155+ $ metaArray20 ['attributes.required ' ] = $ spconfig ->getOptionalArray ('attributes.required ' , array ());
156156
157157 if (empty ($ metaArray20 ['attributes.required ' ])) {
158158 unset($ metaArray20 ['attributes.required ' ]);
159159 }
160160
161- $ description = $ spconfig ->getArray ('description ' , NULL );
161+ $ description = $ spconfig ->getOptionalArray ('description ' , NULL );
162162 if ($ description !== NULL ) {
163163 $ metaArray20 ['description ' ] = $ description ;
164164 }
165165
166- $ nameFormat = $ spconfig ->getString ('attributes.NameFormat ' , NULL );
166+ $ nameFormat = $ spconfig ->getOptionalString ('attributes.NameFormat ' , NULL );
167167 if ($ nameFormat !== NULL ) {
168168 $ metaArray20 ['attributes.NameFormat ' ] = $ nameFormat ;
169169 }
170170 }
171171
172172 // add organization info
173- $ orgName = $ spconfig ->getLocalizedString ('OrganizationName ' , NULL );
173+ $ orgName = $ spconfig ->getOptionalLocalizedString ('OrganizationName ' , NULL );
174174 if ($ orgName !== NULL ) {
175175 $ metaArray20 ['OrganizationName ' ] = $ orgName ;
176176
177- $ metaArray20 ['OrganizationDisplayName ' ] = $ spconfig ->getLocalizedString ('OrganizationDisplayName ' , NULL );
177+ $ metaArray20 ['OrganizationDisplayName ' ] = $ spconfig ->getOptionalLocalizedString ('OrganizationDisplayName ' , NULL );
178178 if ($ metaArray20 ['OrganizationDisplayName ' ] === NULL ) {
179179 $ metaArray20 ['OrganizationDisplayName ' ] = $ orgName ;
180180 }
181181
182- $ metaArray20 ['OrganizationURL ' ] = $ spconfig ->getLocalizedString ('OrganizationURL ' , NULL );
182+ $ metaArray20 ['OrganizationURL ' ] = $ spconfig ->getOptionalLocalizedString ('OrganizationURL ' , NULL );
183183 if ($ metaArray20 ['OrganizationURL ' ] === NULL ) {
184184 throw new SimpleSAML_Error_Exception ('If OrganizationName is set, OrganizationURL must also be set. ' );
185185 }
186186 }
187187
188188 if ($ spconfig ->hasValue ('contacts ' )) {
189- $ contacts = $ spconfig ->getArray ('contacts ' );
189+ $ contacts = $ spconfig ->getOptionalArray ('contacts ' );
190190 foreach ($ contacts as $ contact ) {
191191 $ metaArray20 ['contacts ' ][] = \SimpleSAML \Utils \Config \Metadata::getContact ($ contact );
192192 }
193193 }
194194
195195 // add technical contact
196- $ email = $ config ->getString ('technicalcontact_email ' , 'na@example.org ' , FALSE );
196+ $ email = $ config ->getOptionalString ('technicalcontact_email ' , 'na@example.org ' );
197197 if ($ email && $ email !== 'na@example.org ' ) {
198198 $ techcontact ['emailAddress ' ] = $ email ;
199- $ techcontact ['name ' ] = $ config ->getString ('technicalcontact_name ' , NULL );
199+ $ techcontact ['name ' ] = $ config ->getOptionalString ('technicalcontact_name ' , NULL );
200200 $ techcontact ['contactType ' ] = 'technical ' ;
201201 $ metaArray20 ['contacts ' ][] = \SimpleSAML \Utils \Config \Metadata::getContact ($ techcontact );
202202 }
@@ -210,27 +210,27 @@ function auth_saml2_get_sp_metadata($baseurl = '') {
210210
211211 // add EntityAttributes extension
212212 if ($ spconfig ->hasValue ('EntityAttributes ' )) {
213- $ metaArray20 ['EntityAttributes ' ] = $ spconfig ->getArray ('EntityAttributes ' );
213+ $ metaArray20 ['EntityAttributes ' ] = $ spconfig ->getOptionalArray ('EntityAttributes ' );
214214 }
215215
216216 // add UIInfo extension
217217 if ($ spconfig ->hasValue ('UIInfo ' )) {
218- $ metaArray20 ['UIInfo ' ] = $ spconfig ->getArray ('UIInfo ' );
218+ $ metaArray20 ['UIInfo ' ] = $ spconfig ->getOptionalArray ('UIInfo ' );
219219 }
220220
221221 // add RegistrationInfo extension
222222 if ($ spconfig ->hasValue ('RegistrationInfo ' )) {
223- $ metaArray20 ['RegistrationInfo ' ] = $ spconfig ->getArray ('RegistrationInfo ' );
223+ $ metaArray20 ['RegistrationInfo ' ] = $ spconfig ->getOptionalArray ('RegistrationInfo ' );
224224 }
225225
226226 // add signature options
227227 if ($ spconfig ->hasValue ('WantAssertionsSigned ' )) {
228- $ metaArray20 ['saml20.sign.assertion ' ] = $ spconfig ->getBoolean ('WantAssertionsSigned ' );
228+ $ metaArray20 ['saml20.sign.assertion ' ] = $ spconfig ->getOptionalBoolean ('WantAssertionsSigned ' , false );
229229 }
230230 if ($ spconfig ->hasValue ('redirect.sign ' )) {
231- $ metaArray20 ['redirect.validate ' ] = $ spconfig ->getBoolean ('redirect.sign ' );
231+ $ metaArray20 ['redirect.validate ' ] = $ spconfig ->getOptionalBoolean ('redirect.sign ' , false );
232232 } elseif ($ spconfig ->hasValue ('sign.authnrequest ' )) {
233- $ metaArray20 ['validate.authnrequest ' ] = $ spconfig ->getBoolean ('sign.authnrequest ' );
233+ $ metaArray20 ['validate.authnrequest ' ] = $ spconfig ->getOptionalBoolean ('sign.authnrequest ' , false );
234234 }
235235
236236 $ supported_protocols = array (SAML2 \Constants::NS_SAMLP );
0 commit comments