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

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

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

Assertion.setIssueInstant介绍

[英]Sets the issue instance of this assertion.
[中]设置此断言的问题实例。

代码示例

代码示例来源:origin: line/armeria

assertion.setIssueInstant(DateTime.now());
assertion.setID(requestIdManager.newId());

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

/** {@inheritDoc} */
  protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    Assertion assertion = (Assertion) samlObject;

    if (attribute.getLocalName().equals(Assertion.VERSION_ATTRIB_NAME)) {
      assertion.setVersion(SAMLVersion.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(Assertion.ISSUE_INSTANT_ATTRIB_NAME)
        && !Strings.isNullOrEmpty(attribute.getValue())) {
      assertion.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (attribute.getLocalName().equals(Assertion.ID_ATTRIB_NAME)) {
      assertion.setID(attribute.getValue());
      attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else {
      super.processAttribute(samlObject, attribute);
    }
  }
}

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

/**
 * Constructs and adds a {@link Assertion} to the given {@link Response}. The {@link Assertion} is constructed
 * using the parameters supplied, and its issue instant is set to the issue instant of the given {@link Response}.
 * 
 * @param action the current action
 * @param response the response to which the assertion will be added
 * @param idGenerator source of assertion ID
 * @param issuer value for assertion
 * 
 * @return the assertion that was added to the response
 */
@Nonnull public static Assertion addAssertionToResponse(@Nonnull final AbstractProfileAction action,
    @Nonnull final Response response, @Nonnull final IdentifierGenerationStrategy idGenerator,
    @Nullable final String issuer) {
  final Assertion assertion = buildAssertion(action, idGenerator, issuer);
  assertion.setIssueInstant(response.getIssueInstant());
  getLogger().debug("Profile Action {}: Added Assertion {} to Response {}",
      new Object[] {action.getClass().getSimpleName(), assertion.getID(), response.getID(),});
  response.getAssertions().add(assertion);
  return assertion;
}

代码示例来源:origin: org.jasig.cas/cas-server-support-saml

/**
 * Create a new SAML1 response object.
 *
 * @param authnStatement the authn statement
 * @param issuer the issuer
 * @param issuedAt the issued at
 * @param id the id
 * @return the assertion
 */
public Assertion newAssertion(final AuthnStatement authnStatement, final String issuer,
               final DateTime issuedAt, final String id) {
  final Assertion assertion = newSamlObject(Assertion.class);
  assertion.setID(id);
  assertion.setIssueInstant(issuedAt);
  assertion.setIssuer(newIssuer(issuer));
  assertion.getAuthnStatements().add(authnStatement);
  return assertion;
}

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

/**
 * Create a SAML 2 assertion
 *
 * @return a SAML 2 assertion
 */
@SuppressWarnings("unchecked")
public static Assertion createAssertion() {
  if (assertionBuilder == null) {
    assertionBuilder = (SAMLObjectBuilder<Assertion>)
      builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
    if (assertionBuilder == null) {
      throw new IllegalStateException(
        "OpenSaml engine not initialized. Please make sure to initialize the OpenSaml engine "
        + "prior using it"
      );
    }
  }
  Assertion assertion =
    assertionBuilder.buildObject(Assertion.DEFAULT_ELEMENT_NAME, Assertion.TYPE_NAME);
  assertion.setID(IDGenerator.generateID("_"));
  assertion.setVersion(SAMLVersion.VERSION_20);
  assertion.setIssueInstant(new DateTime());
  return assertion;
}

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

assertion.setIssueInstant(new DateTime());
assertion.setVersion(SAMLVersion.VERSION_20);

代码示例来源:origin: org.apache.cxf.services.sts/cxf-services-sts-core

private void createNewConditions(SamlAssertionWrapper assertion, TokenRenewerParameters tokenParameters) {
  ConditionsBean conditions =
    conditionsProvider.getConditions(convertToProviderParameters(tokenParameters));
  if (assertion.getSaml1() != null) {
    org.opensaml.saml.saml1.core.Assertion saml1Assertion = assertion.getSaml1();
    saml1Assertion.setIssueInstant(new DateTime());
    org.opensaml.saml.saml1.core.Conditions saml1Conditions =
      SAML1ComponentBuilder.createSamlv1Conditions(conditions);
    saml1Assertion.setConditions(saml1Conditions);
  } else {
    org.opensaml.saml.saml2.core.Assertion saml2Assertion = assertion.getSaml2();
    saml2Assertion.setIssueInstant(new DateTime());
    org.opensaml.saml.saml2.core.Conditions saml2Conditions =
      SAML2ComponentBuilder.createConditions(conditions);
    saml2Assertion.setConditions(saml2Conditions);
  }
}

代码示例来源:origin: apache/cxf

private void createNewConditions(SamlAssertionWrapper assertion, TokenRenewerParameters tokenParameters) {
  ConditionsBean conditions =
    conditionsProvider.getConditions(convertToProviderParameters(tokenParameters));
  if (assertion.getSaml1() != null) {
    org.opensaml.saml.saml1.core.Assertion saml1Assertion = assertion.getSaml1();
    saml1Assertion.setIssueInstant(new DateTime());
    org.opensaml.saml.saml1.core.Conditions saml1Conditions =
      SAML1ComponentBuilder.createSamlv1Conditions(conditions);
    saml1Assertion.setConditions(saml1Conditions);
  } else {
    org.opensaml.saml.saml2.core.Assertion saml2Assertion = assertion.getSaml2();
    saml2Assertion.setIssueInstant(new DateTime());
    org.opensaml.saml.saml2.core.Conditions saml2Conditions =
      SAML2ComponentBuilder.createConditions(conditions);
    saml2Assertion.setConditions(saml2Conditions);
  }
}

代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.saml2/org.wso2.carbon.identity.query.saml

samlAssertion.setVersion(SAMLVersion.VERSION_20);
samlAssertion.setIssuer(OpenSAML3Util.getIssuer("carbon.super"));
samlAssertion.setIssueInstant(currentTime);
Subject subject = new SubjectBuilder().buildObject();
NameID nameId = new NameIDBuilder().buildObject();

代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.saml2/org.wso2.carbon.identity.query.saml

samlAssertion.setVersion(SAMLVersion.VERSION_20);
samlAssertion.setIssuer(OpenSAML3Util.getIssuer("carbon.super"));
samlAssertion.setIssueInstant(currentTime);
Subject subject = new SubjectBuilder().buildObject();
NameID nameId = new NameIDBuilder().buildObject();

代码示例来源:origin: spring-projects/spring-security-saml

.class);
a.setVersion(SAMLVersion.VERSION_20);
a.setIssueInstant(request.getIssueInstant());
a.setID(request.getId());
org.opensaml.saml.saml2.core.Issuer issuer = buildSAMLObject(org.opensaml.saml.saml2.core.Issuer

相关文章