org.opensaml.saml1.core.Assertion.getID()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.opensaml.saml1.core.Assertion.getID()方法的一些代码示例,展示了Assertion.getID()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assertion.getID()方法的具体详情如下:
包路径:org.opensaml.saml1.core.Assertion
类名称:Assertion
方法名:getID

Assertion.getID介绍

[英]Set the ID
[中]设置ID

代码示例

代码示例来源:origin: org.opensaml/opensaml

/**
 * Test that the ID is present
 * @param assertion
 * @throws ValidationException
 */
protected void validateId(Assertion assertion) throws ValidationException {
   if (DatatypeHelper.isEmpty(assertion.getID())) {
     throw new ValidationException("ID not present");
   }
}

代码示例来源:origin: org.opensaml/opensaml

/** {@inheritDoc} */
  protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException {

    Assertion assertion = (Assertion) samlElement;

    if (assertion.getID() != null) {
      domElement.setAttributeNS(null, Assertion.ID_ATTRIB_NAME, assertion.getID());
      if (assertion.getMinorVersion() != 0) {
        domElement.setIdAttributeNS(null, Assertion.ID_ATTRIB_NAME, true);
      }
    }

    if (assertion.getIssuer() != null) {
      domElement.setAttributeNS(null, Assertion.ISSUER_ATTRIB_NAME, assertion.getIssuer());
    }

    if (assertion.getIssueInstant() != null) {
      String date = ISODateTimeFormat.dateTime().print(assertion.getIssueInstant());
      domElement.setAttributeNS(null, Assertion.ISSUEINSTANT_ATTRIB_NAME, date);
    }

    domElement.setAttributeNS(null, Assertion.MAJORVERSION_ATTRIB_NAME, "1");
    if (assertion.getMinorVersion() == 0) {
      domElement.setAttributeNS(null, Assertion.MINORVERSION_ATTRIB_NAME, "0");
    } else {
      domElement.setAttributeNS(null, Assertion.MINORVERSION_ATTRIB_NAME, "1");
    }
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j

/**
 * Method getId returns the id of this AssertionWrapper object.
 *
 * @return the id (type String) of this AssertionWrapper object.
 */
public String getId() {
  String id = null;
  if (saml2 != null) {
    id = saml2.getID();
  } else if (saml1 != null) {
    id = saml1.getID();
  } else {
    LOG.error("AssertionWrapper: unable to return ID - no saml assertion object");
  }
  if (id == null || id.length() == 0) {
    LOG.error("AssertionWrapper: ID was null, seeting a new ID value");
    id = "_" + UUIDGenerator.getUUID();
    if (saml2 != null) {
      saml2.setID(id);
    } else if (saml1 != null) {
      saml1.setID(id);
    }
  }
  return id;
}

代码示例来源:origin: org.apache.ws.security/wss4j

/**
 * Method getId returns the id of this AssertionWrapper object.
 *
 * @return the id (type String) of this AssertionWrapper object.
 */
public String getId() {
  String id = null;
  if (saml2 != null) {
    id = saml2.getID();
  } else if (saml1 != null) {
    id = saml1.getID();
  } else {
    LOG.error("AssertionWrapper: unable to return ID - no saml assertion object");
  }
  if (id == null || id.length() == 0) {
    LOG.error("AssertionWrapper: ID was null, seeting a new ID value");
    id = "_" + UUIDGenerator.getUUID();
    if (saml2 != null) {
      saml2.setID(id);
    } else if (saml1 != null) {
      saml1.setID(id);
    }
  }
  return id;
}

代码示例来源:origin: org.opensaml/opensaml

/** {@inheritDoc} */
public XMLObject unmarshall(Element domElement) throws UnmarshallingException {
  // After regular unmarshalling, check the minor version and set ID-ness if not SAML 1.0
  Assertion assertion = (Assertion) super.unmarshall(domElement);
  if (assertion.getMinorVersion() != 0 && !DatatypeHelper.isEmpty(assertion.getID())) {
    domElement.setIdAttributeNS(null, Assertion.ID_ATTRIB_NAME, true);
  }
  return assertion;
}

代码示例来源:origin: org.apache.rampart/rampart-core

@Override
protected void processSAMLAssertion() {
  this.setAssertionId(assertion.getID());
  //Read the validity period from the 'Conditions' element, else read it from SC Data
  if (assertion.getConditions() != null) {
    Conditions conditions = assertion.getConditions();
    if (conditions.getNotBefore() != null) {
      this.setDateNotBefore(conditions.getNotBefore().toDate());
    }
    if (conditions.getNotOnOrAfter() != null) {
      this.setDateNotOnOrAfter(conditions.getNotOnOrAfter().toDate());
    }
  }
}

代码示例来源:origin: org.apache.rampart/rampart-trust

TrustUtil.createRequestedAttachedRef(rstrElem, assertion.getID(),wstVersion);
TrustUtil.createRequestedUnattachedRef(rstrElem, assertion.getID(),wstVersion);
assertionToken = new Token(assertion.getID(),
    (OMElement) assertion.getDOM(), creationTime.toDate(),
    expirationTime.toDate());

代码示例来源:origin: org.apache.ws.security/wss4j

) throws WSSecurityException {
  byte[] key = getSecretKeyFromCallbackHandler(assertion.getID(), data.getCallbackHandler());
  if (key != null && key.length > 0) {
    return new SAMLKeyInfo(key);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j

) throws WSSecurityException {
  byte[] key = getSecretKeyFromCallbackHandler(assertion.getID(), data.getCallbackHandler());
  if (key != null && key.length > 0) {
    return new SAMLKeyInfo(key);

相关文章