/** {@inheritDoc} */ @Override @Nullable protected XMLObject encodeValue(@Nonnull final IdPAttribute attribute, @Nonnull final XMLObjectAttributeValue value) throws AttributeEncodingException { return SAMLEncoderSupport.encodeXMLObjectValue(attribute, AttributeValue.DEFAULT_ELEMENT_NAME, value.getValue()); } }
/** {@inheritDoc} */ @Nullable protected IdPAttributeValue decodeValue(@Nonnull final XMLObject object) { Constraint.isNotNull(object, "Object supplied to must not be null"); if (includeAttributeValue) { return new XMLObjectAttributeValue(object); } final List<XMLObject> children = object.getOrderedChildren(); if (null == children || children.isEmpty()) { log.debug("{} attribute had no XML children, ignored", getLogPrefix()); return null; } if (children.size() > 1) { log.debug("{} attribute has more than one child, returning first value only", getLogPrefix()); } final XMLObject child = children.get(0); log.debug("{} returning value of type {}", getLogPrefix(), child.getClass().toString()); return new XMLObjectAttributeValue(child); }
/** {@inheritDoc} */ @Override @Nullable protected XMLObject encodeValue(@Nonnull final IdPAttribute attribute, @Nonnull final XMLObjectAttributeValue value) throws AttributeEncodingException { return SAMLEncoderSupport .encodeXMLObjectValue(attribute, AttributeValue.DEFAULT_ELEMENT_NAME, value.getValue()); }
/** * Worker function for doAttributeDefintionResolve. This returns an AttributeValue if the input value is appropriate * for encoding as a NameID. * * @param theValue an arbitrary value. * @param resolutionContext the context to get the rest of the values from * @return null or an attributeValue; * @throws ResolutionException if the IdP Name is empty. */ @Nullable private XMLObjectAttributeValue encodeOneValue(@Nonnull final IdPAttributeValue<?> theValue, @Nonnull final AttributeResolutionContext resolutionContext) throws ResolutionException { if (theValue instanceof StringAttributeValue) { final String value = StringSupport.trimOrNull(((StringAttributeValue) theValue).getValue()); if (value == null) { log.warn("{} Value was all whitespace", getLogPrefix()); return null; } final NameIdentifier nid = buildNameId(value, resolutionContext); final XMLObjectAttributeValue val = new XMLObjectAttributeValue(nid); return val; } log.warn("{} Unsupported value type: {}", getLogPrefix(), theValue.getClass().getName()); return null; }
try { objectOutputStream.writeObject(SerializeSupport.nodeToString( XMLObjectSupport.marshall(((XMLObjectAttributeValue) value).getValue()))); } catch (final MarshallingException e) { log.error("Error while marshalling XMLObject value", e);
/** * Worker function for doAttributeDefintionResolve. This returns an AttributeValue if the input value is appropriate * for encoding as a NameID. * * @param theValue an arbitrary value. * @param resolutionContext the context to get the rest of the values from * @return null or an attributeValue. * @throws ResolutionException if the IdP Name is empty. */ @Nullable private XMLObjectAttributeValue encodeOneValue(@Nonnull final IdPAttributeValue theValue, @Nonnull final AttributeResolutionContext resolutionContext) throws ResolutionException { if (theValue instanceof StringAttributeValue) { final String value = StringSupport.trimOrNull(((StringAttributeValue) theValue).getValue()); if (value == null) { log.warn("{} Value was all whitespace", getLogPrefix()); return null; } final NameID nid = buildNameId(value, resolutionContext); final XMLObjectAttributeValue val = new XMLObjectAttributeValue(nid); return val; } log.warn("{} Unsupported value type: {}", getLogPrefix(), theValue.getClass().getName()); return null; }
try { objectOutputStream.writeObject(SerializeSupport.nodeToString( XMLObjectSupport.marshall(((XMLObjectAttributeValue) value).getValue()))); } catch (final MarshallingException e) { log.error("Error while marshalling XMLObject value", e);