File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 1414use SAML2 \Constants ;
1515use SAML2 \DOMDocumentFactory ;
1616use Serializable ;
17+ use JsonSerializable ;
1718
18- abstract class NameIDType implements Serializable
19+ abstract class NameIDType implements Serializable, \JsonSerializable
1920{
2021 use IDNameQualifiersTrait;
2122
@@ -267,4 +268,26 @@ public function __toString()
267268
268269 return $ doc ->saveXML ($ ele );
269270 }
271+
272+
273+ /**
274+ * Because we have mostly protected attributes we do not look
275+ * interesting when converted into JSON. This allows for good
276+ * visibility from JSON which is used on the admin/test login page
277+ * when showing the attributes for the user.
278+ *
279+ * @return array associative array of defined object accessible
280+ * non-static properties for the specified object in scope.
281+ */
282+ public function jsonSerialize (): array
283+ {
284+ return [
285+ 'NameQualifier ' => $ this ->getNameQualifier (),
286+ 'SPNameQualifier ' => $ this ->getSPNameQualifier (),
287+ 'nodeName ' => $ this ->nodeName ,
288+ 'Format ' => $ this ->Format ,
289+ 'SPProvidedID ' => $ this ->SPProvidedID ,
290+ 'value ' => $ this ->value
291+ ];
292+ }
270293}
You can’t perform that action at this time.
0 commit comments