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