Property Visibilities

This commit is contained in:
2023-01-07 15:34:05 +01:00
parent 99bfd7e505
commit d115d8b970
30 changed files with 241 additions and 215 deletions

View File

@@ -58,18 +58,18 @@ class KeyBasedTwoFactorToken extends TwoFactorToken {
return $this->credentialId;
}
public function jsonSerialize(): array {
$json = parent::jsonSerialize();
public function jsonSerialize(?array $propertyNames = null): array {
$jsonData = parent::jsonSerialize();
if (!empty($this->challenge) && !$this->isAuthenticated()) {
$json["challenge"] = base64_encode($this->challenge);
if (!empty($this->challenge) && !$this->isAuthenticated() && in_array("challenge", $propertyNames)) {
$jsonData["challenge"] = base64_encode($this->challenge);
}
if (!empty($this->credentialId)) {
$json["credentialID"] = base64_encode($this->credentialId);
if (!empty($this->credentialId) && in_array("credentialID", $propertyNames)) {
$jsonData["credentialID"] = base64_encode($this->credentialId);
}
return $json;
return $jsonData;
}
// TODO: algorithms, hardcoded values, ...