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

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

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

Assertion.setIssueInstant介绍

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

代码示例

代码示例来源:origin: cloudfoundry/uaa

private Assertion buildAssertion(Authentication authentication, AuthnRequest authnRequest,
    IdpWebSSOProfileOptions options, String audienceURI, String issuerEntityId) throws SAMLException{
  @SuppressWarnings("unchecked")
  SAMLObjectBuilder<Assertion> assertionBuilder = (SAMLObjectBuilder<Assertion>) builderFactory
      .getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
  Assertion assertion = assertionBuilder.buildObject();
  assertion.setID(generateID());
  assertion.setIssueInstant(new DateTime());
  assertion.setVersion(SAMLVersion.VERSION_20);
  assertion.setIssuer(getIssuer(issuerEntityId));
  buildAssertionAuthnStatement(assertion);
  buildAssertionConditions(assertion, options.getAssertionTimeToLiveSeconds(), audienceURI);
  buildAssertionSubject(assertion, authnRequest, options.getAssertionTimeToLiveSeconds(),
      (UaaPrincipal) authentication.getPrincipal());
  buildAttributeStatement(assertion, authentication, audienceURI);
  return assertion;
}

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

/** {@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)
        && !DatatypeHelper.isEmpty(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.apache.ws.security/wss4j

/**
 * 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("_" + UUIDGenerator.getUUID());
  assertion.setVersion(SAMLVersion.VERSION_20);
  assertion.setIssueInstant(new DateTime());
  return assertion;
}

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

/**
 * 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("_" + UUIDGenerator.getUUID());
  assertion.setVersion(SAMLVersion.VERSION_20);
  assertion.setIssueInstant(new DateTime());
  return assertion;
}

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

/**
 * 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);
  assertionId = UUIDGenerator.getUUID();
  assertion.setID(assertionId);
  assertion.setVersion(SAMLVersion.VERSION_20);
  assertion.setIssueInstant(new DateTime());
  return assertion;
}

代码示例来源:origin: se.skltp.adapterservices.se.apotekensservice/TicketMachine

@Override
public Assertion build() {
  AssertionBuilder assertionBuilder = (AssertionBuilder) xmlObjectBuilderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
  Assertion assertion = assertionBuilder.buildObject();        
  assertion.setID(id);
  assertion.setIssueInstant(issueInstant);
  assertion.setVersion(SAMLVersion.VERSION_20);
  assertion.setIssuer(issuer);
  assertion.setSubject(subject);
  assertion.setConditions(conditions);
  if(signature !=null){
    assertion.setSignature(signature);
  }
  if(authnStatements.size() > 0){
    for (AuthnStatement authnStatement : authnStatements) {
      assertion.getAuthnStatements().add(authnStatement);
    }
  }
  if(attributeStatements.size() > 0){
    for (AttributeStatement attributeStatement : attributeStatements) {
      assertion.getAttributeStatements().add(attributeStatement);
    }
  }
  
  return assertion;
}

代码示例来源:origin: OpenConext/Mujina

public static Assertion buildAssertion(SAMLPrincipal principal, Status status, String entityId) {
 Assertion assertion = buildSAMLObject(Assertion.class, Assertion.DEFAULT_ELEMENT_NAME);
 if (status.getStatusCode().getValue().equals(StatusCode.SUCCESS_URI)) {
  Subject subject = buildSubject(principal.getNameID(), principal.getNameIDType(), principal.getAssertionConsumerServiceURL(), principal.getRequestID());
  assertion.setSubject(subject);
 }
 Issuer issuer = buildIssuer(entityId);
 Audience audience = buildSAMLObject(Audience.class, Audience.DEFAULT_ELEMENT_NAME);
 audience.setAudienceURI(principal.getServiceProviderEntityID());
 AudienceRestriction audienceRestriction = buildSAMLObject(AudienceRestriction.class, AudienceRestriction.DEFAULT_ELEMENT_NAME);
 audienceRestriction.getAudiences().add(audience);
 Conditions conditions = buildSAMLObject(Conditions.class, Conditions.DEFAULT_ELEMENT_NAME);
 conditions.getAudienceRestrictions().add(audienceRestriction);
 assertion.setConditions(conditions);
 AuthnStatement authnStatement = buildAuthnStatement(new DateTime(), entityId);
 assertion.setIssuer(issuer);
 assertion.getAuthnStatements().add(authnStatement);
 assertion.getAttributeStatements().add(buildAttributeStatement(principal.getAttributes()));
 assertion.setID(randomSAMLId());
 assertion.setIssueInstant(new DateTime());
 return assertion;
}

代码示例来源:origin: org.wso2.carbon.identity.framework/org.wso2.carbon.identity.entitlement

assertion.setVersion(org.opensaml.common.SAMLVersion.VERSION_20);
assertion.setIssuer(createIssuer());
assertion.setIssueInstant(currentTime);
assertion.getStatements().add(xacmlAuthzDecisionStatement);
ResponseBuilder builder = (ResponseBuilder) org.opensaml.xml.Configuration.getBuilderFactory()

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

assertion.setIssueInstant(creationDate);

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.entitlement

assertion.setVersion(org.opensaml.common.SAMLVersion.VERSION_20);
assertion.setIssuer(createIssuer());
assertion.setIssueInstant(currentTime);
assertion.getStatements().add(xacmlAuthzDecisionStatement);
ResponseBuilder builder = (ResponseBuilder) org.opensaml.xml.Configuration.getBuilderFactory()

代码示例来源:origin: wso2/carbon-identity-framework

assertion.setVersion(org.opensaml.common.SAMLVersion.VERSION_20);
assertion.setIssuer(createIssuer());
assertion.setIssueInstant(currentTime);
assertion.getStatements().add(xacmlAuthzDecisionStatement);
ResponseBuilder builder = (ResponseBuilder) org.opensaml.xml.Configuration.getBuilderFactory()

代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.openid/org.wso2.carbon.identity.provider

issuer.setValue(host);
assertion.setIssuer(issuer);
assertion.setIssueInstant(new DateTime());

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.provider

issuer.setValue(host);
assertion.setIssuer(issuer);
assertion.setIssueInstant(new DateTime());

代码示例来源:origin: be.e_contract.sts/sts-client-cxf

assertion.setID(assertionId);
DateTime issueInstant = new DateTime();
assertion.setIssueInstant(issueInstant);

代码示例来源:origin: be.fedict.eid-idp/eid-idp-common-saml2

String assertionId = "assertion-" + UUID.randomUUID().toString();
assertion.setID(assertionId);
assertion.setIssueInstant(issueInstant);

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

assertion.setVersion(SAMLVersion.VERSION_20);
assertion.setIssuer(getIssuer());
assertion.setIssueInstant(currentTime);
Subject subjectElem = new SubjectBuilder().buildObject();

代码示例来源:origin: org.wso2.carbon.identity.tool.validator.sso.saml2/org.wso2.carbon.identity.tools.saml.validator

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

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.tools.saml.validator

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

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.sso.saml

samlAssertion.setVersion(SAMLVersion.VERSION_20);
samlAssertion.setIssuer(SAMLSSOUtil.getIssuer());
samlAssertion.setIssueInstant(currentTime);
Subject subject = new SubjectBuilder().buildObject();

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

samlAssertion.setVersion(SAMLVersion.VERSION_20);
samlAssertion.setIssuer(SAMLSSOUtil.getIssuer());
samlAssertion.setIssueInstant(currentTime);
Subject subject = new SubjectBuilder().buildObject();

相关文章