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

x33g5p2x  于2022-01-16 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(129)

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

Assertion.getIssueInstant介绍

[英]Gets the issue instance of this assertion.
[中]获取此断言的问题实例。

代码示例

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

/**
   * Checks that the IssueInstant attribute is present.
   * 
   * @param assertion
   * @throws ValidationException
   */
  protected void validateIssueInstant(Assertion assertion) throws ValidationException {
    if (assertion.getIssueInstant() == null) {
      throw new ValidationException("IssueInstant is required attribute");
    }
  }
}

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

/** {@inheritDoc} */
  protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
    Assertion assertion = (Assertion) samlObject;

    if (assertion.getVersion() != null) {
      domElement.setAttributeNS(null, Assertion.VERSION_ATTRIB_NAME, assertion.getVersion().toString());
    }

    if (assertion.getIssueInstant() != null) {
      String issueInstantStr = Configuration.getSAMLDateFormatter().print(assertion.getIssueInstant());
      domElement.setAttributeNS(null, Assertion.ISSUE_INSTANT_ATTRIB_NAME, issueInstantStr);
    }

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

代码示例来源:origin: metatron-app/metatron-discovery

public General(Authentication authentication){
 SAMLCredential credential = (SAMLCredential) authentication.getCredentials();
 NameID nameID = credential.getNameID();
 name = authentication.getName();
 principal = authentication.getPrincipal();
 nameId = nameID.getValue();
 nameIdFormat = nameID.getFormat();
 idp = credential.getAuthenticationAssertion().getIssuer().getValue();
 assertionIssueTime = credential.getAuthenticationAssertion().getIssueInstant();
}

代码示例来源:origin: usnistgov/iheos-toolkit2

private void verifyAssertion(Assertion assertion, AuthnRequest request, BasicSAMLMessageContext context) throws  SAMLException, org.opensaml.xml.security.SecurityException, ValidationException, Exception {
  // Verify assertion time skew
  if (!isDateTimeSkewValid(MAX_ASSERTION_TIME, assertion.getIssueInstant())) {
    System.out.println("Authentication statement is too old to be used"+assertion.getIssueInstant());
    throw new Exception("Users authentication credential is too old to be used");
  }
  // Verify validity of assertion
  // Advice is ignored, core 574
  verifyIssuer(assertion.getIssuer(), context);
  verifyAssertionSignature(assertion.getSignature(), context);
  verifySubject(assertion.getSubject(), request, context);
  // Assertion with authentication statement must contain audience restriction
  if (assertion.getAuthnStatements().size() > 0) {
    verifyAssertionConditions(assertion.getConditions(), context, true);
    for (AuthnStatement statement : assertion.getAuthnStatements()) {
      verifyAuthenticationStatement(statement, context);
    }
  } else {
    verifyAssertionConditions(assertion.getConditions(), context, false);
  }
}
/**

代码示例来源:origin: usnistgov/iheos-toolkit2

if (oElement.getIssueInstant() != null) {
  oSamlEvidAssert.setIssueInstant(oElement.getIssueInstant().toString());
  log.debug("Assertion.SamlAuthzDecisionStatement.Evidence.Assertion.IssueInstant = " + oElement.getIssueInstant());

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

validFrom = assertion.getSaml2().getConditions().getNotBefore();
  validTill = assertion.getSaml2().getConditions().getNotOnOrAfter();
  issueInstant = assertion.getSaml2().getIssueInstant();
} else if (assertion.getSamlVersion().equals(SAMLVersion.VERSION_11)
  && assertion.getSaml1().getConditions() != null) {

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

validFrom = assertion.getSaml2().getConditions().getNotBefore();
  validTill = assertion.getSaml2().getConditions().getNotOnOrAfter();
  issueInstant = assertion.getSaml2().getIssueInstant();
} else if (assertion.getSamlVersion().equals(SAMLVersion.VERSION_11)
  && assertion.getSaml1().getConditions() != null) {

代码示例来源:origin: org.springframework.security.extensions/spring-security-saml2-core

protected void verifyAssertion(Assertion assertion, AuthnRequest request, SAMLMessageContext context) throws AuthenticationException, SAMLException, org.opensaml.xml.security.SecurityException, ValidationException, DecryptionException {
  // Verify storage time skew
  if (!isDateTimeSkewValid(getResponseSkew(), getMaxAssertionTime(), assertion.getIssueInstant())) {
    throw new SAMLException("Assertion is too old to be used, value can be customized by setting maxAssertionTime value " + assertion.getIssueInstant());
  }
  // Verify validity of storage
  // Advice is ignored, core 574
  verifyIssuer(assertion.getIssuer(), context);
  verifyAssertionSignature(assertion.getSignature(), context);
  // Check subject
  if (assertion.getSubject() != null) {
    verifySubject(assertion.getSubject(), request, context);
  } else {
    throw new SAMLException("Assertion does not contain subject and is discarded");
  }
  // Assertion with authentication statement must contain audience restriction
  if (assertion.getAuthnStatements().size() > 0) {
    verifyAssertionConditions(assertion.getConditions(), context, true);
    for (AuthnStatement statement : assertion.getAuthnStatements()) {
      if (request != null) {
        verifyAuthenticationStatement(statement, request.getRequestedAuthnContext(), context);
      } else {
        verifyAuthenticationStatement(statement, null, context);
      }
    }
  } else {
    verifyAssertionConditions(assertion.getConditions(), context, false);
  }
}

代码示例来源:origin: org.adeptnet.auth/auth-saml

final DateTime instant = assertion.getIssueInstant();
if (instant != null) {
  if (instant.isBefore(now.minusDays(1).minusSeconds(slack))) {

代码示例来源:origin: lastpass/saml-sdk-java

DateTime instant = assertion.getIssueInstant();
if (instant != null) {
  if (instant.isBefore(now.minusSeconds(slack)))

相关文章