internal static AuthenticationMechanism DeserializeAuthenticationMechanism(JsonElement element) { Optional <SymmetricKey> symmetricKey = default; Optional <X509Thumbprint> x509Thumbprint = default; Optional <AuthenticationMechanismType> type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("symmetricKey")) { symmetricKey = SymmetricKey.DeserializeSymmetricKey(property.Value); continue; } if (property.NameEquals("x509Thumbprint")) { x509Thumbprint = X509Thumbprint.DeserializeX509Thumbprint(property.Value); continue; } if (property.NameEquals("type")) { type = new AuthenticationMechanismType(property.Value.GetString()); continue; } } return(new AuthenticationMechanism(symmetricKey.Value, x509Thumbprint.Value, Optional.ToNullable(type))); }
internal static AuthenticationMechanism DeserializeAuthenticationMechanism(JsonElement element) { SymmetricKey symmetricKey = default; X509Thumbprint x509Thumbprint = default; AuthenticationMechanismType?type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("symmetricKey")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } symmetricKey = SymmetricKey.DeserializeSymmetricKey(property.Value); continue; } if (property.NameEquals("x509Thumbprint")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } x509Thumbprint = X509Thumbprint.DeserializeX509Thumbprint(property.Value); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } type = new AuthenticationMechanismType(property.Value.GetString()); continue; } } return(new AuthenticationMechanism(symmetricKey, x509Thumbprint, type)); }