type property is an string node, not an array

This commit is contained in:
Xavi Aracil 2022-11-24 09:11:22 +01:00
parent 904c97aced
commit c47a04aa8c

View File

@ -25,7 +25,7 @@ public class Assertion extends Credential {
protected Assertion(Resource resource, JsonNode data, String jwt, Map<String, SchemaKey> schemas) {
super(ID, resource, data, jwt, schemas);
ArrayNode typeNode = (ArrayNode)jsonData.get("type");
JsonNode typeNode = jsonData.get("type");
this.assertionType = Assertion.Type.valueOf(typeNode);
}
@ -63,16 +63,13 @@ public class Assertion extends Credential {
Assertion,
Unknown;
public static Assertion.Type valueOf (ArrayNode typeArray) {
if(typeArray != null) {
Iterator<JsonNode> iter = typeArray.iterator();
while(iter.hasNext()) {
String value = iter.next().asText();
public static Assertion.Type valueOf (JsonNode typeNode) {
if(typeNode != null) {
String value = typeNode.asText();
if(value.equals("Assertion")) {
return Assertion;
}
}
}
return Unknown;
}
}