@@ -146,57 +146,57 @@ function auth_saml2_get_sp_metadata($baseurl = '') {
146
146
$ metaArray20 ['NameIDFormat ' ] = $ format ;
147
147
}
148
148
149
- $ name = $ spconfig ->getLocalizedString ('name ' , NULL );
150
- $ attributes = $ spconfig ->getArray ('attributes ' , array ());
149
+ $ name = $ spconfig ->getOptionalLocalizedString ('name ' , NULL );
150
+ $ attributes = $ spconfig ->getOptionalArray ('attributes ' , array ());
151
151
152
152
if ($ name !== NULL && !empty ($ attributes )) {
153
153
$ metaArray20 ['name ' ] = $ name ;
154
154
$ metaArray20 ['attributes ' ] = $ attributes ;
155
- $ metaArray20 ['attributes.required ' ] = $ spconfig ->getArray ('attributes.required ' , array ());
155
+ $ metaArray20 ['attributes.required ' ] = $ spconfig ->getOptionalArray ('attributes.required ' , array ());
156
156
157
157
if (empty ($ metaArray20 ['attributes.required ' ])) {
158
158
unset($ metaArray20 ['attributes.required ' ]);
159
159
}
160
160
161
- $ description = $ spconfig ->getArray ('description ' , NULL );
161
+ $ description = $ spconfig ->getOptionalArray ('description ' , NULL );
162
162
if ($ description !== NULL ) {
163
163
$ metaArray20 ['description ' ] = $ description ;
164
164
}
165
165
166
- $ nameFormat = $ spconfig ->getString ('attributes.NameFormat ' , NULL );
166
+ $ nameFormat = $ spconfig ->getOptionalString ('attributes.NameFormat ' , NULL );
167
167
if ($ nameFormat !== NULL ) {
168
168
$ metaArray20 ['attributes.NameFormat ' ] = $ nameFormat ;
169
169
}
170
170
}
171
171
172
172
// add organization info
173
- $ orgName = $ spconfig ->getLocalizedString ('OrganizationName ' , NULL );
173
+ $ orgName = $ spconfig ->getOptionalLocalizedString ('OrganizationName ' , NULL );
174
174
if ($ orgName !== NULL ) {
175
175
$ metaArray20 ['OrganizationName ' ] = $ orgName ;
176
176
177
- $ metaArray20 ['OrganizationDisplayName ' ] = $ spconfig ->getLocalizedString ('OrganizationDisplayName ' , NULL );
177
+ $ metaArray20 ['OrganizationDisplayName ' ] = $ spconfig ->getOptionalLocalizedString ('OrganizationDisplayName ' , NULL );
178
178
if ($ metaArray20 ['OrganizationDisplayName ' ] === NULL ) {
179
179
$ metaArray20 ['OrganizationDisplayName ' ] = $ orgName ;
180
180
}
181
181
182
- $ metaArray20 ['OrganizationURL ' ] = $ spconfig ->getLocalizedString ('OrganizationURL ' , NULL );
182
+ $ metaArray20 ['OrganizationURL ' ] = $ spconfig ->getOptionalLocalizedString ('OrganizationURL ' , NULL );
183
183
if ($ metaArray20 ['OrganizationURL ' ] === NULL ) {
184
184
throw new SimpleSAML_Error_Exception ('If OrganizationName is set, OrganizationURL must also be set. ' );
185
185
}
186
186
}
187
187
188
188
if ($ spconfig ->hasValue ('contacts ' )) {
189
- $ contacts = $ spconfig ->getArray ('contacts ' );
189
+ $ contacts = $ spconfig ->getOptionalArray ('contacts ' );
190
190
foreach ($ contacts as $ contact ) {
191
191
$ metaArray20 ['contacts ' ][] = \SimpleSAML \Utils \Config \Metadata::getContact ($ contact );
192
192
}
193
193
}
194
194
195
195
// add technical contact
196
- $ email = $ config ->getString ('technicalcontact_email ' , 'na@example.org ' , FALSE );
196
+ $ email = $ config ->getOptionalString ('technicalcontact_email ' , 'na@example.org ' );
197
197
if ($ email && $ email !== 'na@example.org ' ) {
198
198
$ techcontact ['emailAddress ' ] = $ email ;
199
- $ techcontact ['name ' ] = $ config ->getString ('technicalcontact_name ' , NULL );
199
+ $ techcontact ['name ' ] = $ config ->getOptionalString ('technicalcontact_name ' , NULL );
200
200
$ techcontact ['contactType ' ] = 'technical ' ;
201
201
$ metaArray20 ['contacts ' ][] = \SimpleSAML \Utils \Config \Metadata::getContact ($ techcontact );
202
202
}
@@ -210,27 +210,27 @@ function auth_saml2_get_sp_metadata($baseurl = '') {
210
210
211
211
// add EntityAttributes extension
212
212
if ($ spconfig ->hasValue ('EntityAttributes ' )) {
213
- $ metaArray20 ['EntityAttributes ' ] = $ spconfig ->getArray ('EntityAttributes ' );
213
+ $ metaArray20 ['EntityAttributes ' ] = $ spconfig ->getOptionalArray ('EntityAttributes ' );
214
214
}
215
215
216
216
// add UIInfo extension
217
217
if ($ spconfig ->hasValue ('UIInfo ' )) {
218
- $ metaArray20 ['UIInfo ' ] = $ spconfig ->getArray ('UIInfo ' );
218
+ $ metaArray20 ['UIInfo ' ] = $ spconfig ->getOptionalArray ('UIInfo ' );
219
219
}
220
220
221
221
// add RegistrationInfo extension
222
222
if ($ spconfig ->hasValue ('RegistrationInfo ' )) {
223
- $ metaArray20 ['RegistrationInfo ' ] = $ spconfig ->getArray ('RegistrationInfo ' );
223
+ $ metaArray20 ['RegistrationInfo ' ] = $ spconfig ->getOptionalArray ('RegistrationInfo ' );
224
224
}
225
225
226
226
// add signature options
227
227
if ($ spconfig ->hasValue ('WantAssertionsSigned ' )) {
228
- $ metaArray20 ['saml20.sign.assertion ' ] = $ spconfig ->getBoolean ('WantAssertionsSigned ' );
228
+ $ metaArray20 ['saml20.sign.assertion ' ] = $ spconfig ->getOptionalBoolean ('WantAssertionsSigned ' , false );
229
229
}
230
230
if ($ spconfig ->hasValue ('redirect.sign ' )) {
231
- $ metaArray20 ['redirect.validate ' ] = $ spconfig ->getBoolean ('redirect.sign ' );
231
+ $ metaArray20 ['redirect.validate ' ] = $ spconfig ->getOptionalBoolean ('redirect.sign ' , false );
232
232
} elseif ($ spconfig ->hasValue ('sign.authnrequest ' )) {
233
- $ metaArray20 ['validate.authnrequest ' ] = $ spconfig ->getBoolean ('sign.authnrequest ' );
233
+ $ metaArray20 ['validate.authnrequest ' ] = $ spconfig ->getOptionalBoolean ('sign.authnrequest ' , false );
234
234
}
235
235
236
236
$ supported_protocols = array (SAML2 \Constants::NS_SAMLP );
0 commit comments