示例#1
0
  /** {@inheritDoc} */
  protected void processAttribute(XMLObject samlObject, Attr attribute)
      throws UnmarshallingException {
    Response response = (Response) samlObject;

    QName attrName = XMLHelper.getNodeQName(attribute);
    if (Response.SOAP11_MUST_UNDERSTAND_ATTR_NAME.equals(attrName)) {
      response.setSOAP11MustUnderstand(XSBooleanValue.valueOf(attribute.getValue()));
    } else if (Response.SOAP11_ACTOR_ATTR_NAME.equals(attrName)) {
      response.setSOAP11Actor(attribute.getValue());
    } else if (Response.REF_TO_MESSAGE_ID_ATTRIB_NAME.equals(attribute.getLocalName())) {
      response.setRefToMessageID(attribute.getValue());
    } else {
      super.processAttribute(samlObject, attribute);
    }
  }
  /**
   * Process attribute.
   *
   * @param samlObject the SAML object
   * @param attribute the attribute
   * @throws UnmarshallingException the unmarshalling exception
   */
  protected final void processAttribute(final XMLObject samlObject, final Attr attribute)
      throws UnmarshallingException {

    final RequestedAttribute requestedAttr = (RequestedAttribute) samlObject;

    if (attribute.getLocalName().equals(RequestedAttribute.NAME_ATTRIB_NAME)) {
      requestedAttr.setName(attribute.getValue());
    } else if (attribute.getLocalName().equals(RequestedAttribute.NAME_FORMAT_ATTR)) {
      requestedAttr.setNameFormat(attribute.getValue());
    } else if (attribute.getLocalName().equals(RequestedAttribute.FRIENDLY_NAME_ATT)) {
      requestedAttr.setFriendlyName(attribute.getValue());
    } else if (attribute.getLocalName().equals(RequestedAttribute.IS_REQUIRED_ATTR)) {
      requestedAttr.setIsRequired(attribute.getValue());

    } else {
      final QName attribQName = XMLHelper.getNodeQName(attribute);
      if (attribute.isId()) {
        requestedAttr.getUnknownAttributes().registerID(attribQName);
      }
      requestedAttr.getUnknownAttributes().put(attribQName, attribute.getValue());
    }
  }
  /** {@inheritDoc} */
  protected void processAttribute(XMLObject samlObject, Attr attribute)
      throws UnmarshallingException {
    EntityDescriptor entityDescriptor = (EntityDescriptor) samlObject;

    if (attribute.getLocalName().equals(EntityDescriptor.ENTITY_ID_ATTRIB_NAME)) {
      entityDescriptor.setEntityID(attribute.getValue());
    } else if (attribute.getLocalName().equals(EntityDescriptor.ID_ATTRIB_NAME)) {
      entityDescriptor.setID(attribute.getValue());
      attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else if (attribute.getLocalName().equals(TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME)
        && !DatatypeHelper.isEmpty(attribute.getValue())) {
      entityDescriptor.setValidUntil(
          new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (attribute.getLocalName().equals(CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME)) {
      entityDescriptor.setCacheDuration(XMLHelper.durationToLong(attribute.getValue()));
    } else {
      QName attribQName = XMLHelper.getNodeQName(attribute);
      if (attribute.isId()) {
        entityDescriptor.getUnknownAttributes().registerID(attribQName);
      }
      entityDescriptor.getUnknownAttributes().put(attribQName, attribute.getValue());
    }
  }