I'm aware there is already a question here on stackoverflow where this is discussed, but I still have trouble to send the correct values to Bag.newAttributeBag and was hoping for some help.
final Collection<StringValue> subjectList = new ArrayList<>();
subjectList.add("123456");
subjectList.add("John Smith");
final AttributeFqn subjectIdAttributeId = AttributeFqns.newInstance(XACML_1_0_ACCESS_SUBJECT.value(), Optional.empty(), XacmlAttributeId.XACML_1_0_SUBJECT_ID.value());
final AttributeBag<?> subjectIdAttributeValues = Bags.newAttributeBag(StandardDatatypes.STRING, subjectList);
requestBuilder.putNamedAttributeIfAbsent(subjectIdAttributeId, subjectIdAttributeValues);
If I use Collection StringValue I get an error on subjectList.add
The method add(StringValue) in the type Collection is not applicable for the arguments (String)
If I use Collection<String>
I get an error on newAttributeBag. How can I add multiple values to my Bag.newAttributeBag?
The method newAttributeBag(Datatype, Collection) in the type Bags is not applicable for the arguments (AttributeDatatype, Collection)
You should do:
subjectList.add(new StringValue("123456"));
subjectList.add(new StringValue("John Smith"));