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

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

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

Assertion.setConditions介绍

[英]Set the Object representing the Conditions Sub element.
[中]设置表示Conditions子元素的对象。

代码示例

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

/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
    throws UnmarshallingException {
  Assertion assertion = (Assertion) parentSAMLObject;
  if (childSAMLObject instanceof Signature) {
    assertion.setSignature((Signature) childSAMLObject);
  } else if (childSAMLObject instanceof Conditions) {
    assertion.setConditions((Conditions) childSAMLObject);
  } else if (childSAMLObject instanceof Advice) {
    assertion.setAdvice((Advice) childSAMLObject);
  } else if (childSAMLObject instanceof Statement) {
    assertion.getStatements().add((Statement) childSAMLObject);
  } else {
    super.processChildElement(parentSAMLObject, childSAMLObject);
  }
}

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

@Override
public void createSAMLAssertion(DateTime notAfter, DateTime notBefore, String assertionId)
    throws IdentityProviderException {
  assertion = (Assertion) buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME);
  Conditions conditions = (Conditions) buildXMLObject(Conditions.DEFAULT_ELEMENT_NAME);
  conditions.setNotBefore(notBefore);
  conditions.setNotOnOrAfter(notAfter);
  ServerConfiguration config = ServerConfiguration.getInstance();
  String host = "http://" + config.getFirstProperty("HostName");
  assertion.setIssuer(host);
  assertion.setIssueInstant(new DateTime());
  if (appilesTo != null) {
    Audience audience = (Audience) buildXMLObject(Audience.DEFAULT_ELEMENT_NAME);
    audience.setUri(appilesTo);
    AudienceRestrictionCondition audienceRestrictions =
        (AudienceRestrictionCondition) buildXMLObject(AudienceRestrictionCondition.DEFAULT_ELEMENT_NAME);
    audienceRestrictions.getAudiences().add(audience);
    conditions.getAudienceRestrictionConditions().add(audienceRestrictions);
  }
  assertion.setConditions(conditions);
  assertion.getAttributeStatements().add(this.attributeStmt);
  assertion.setID(assertionId);
}

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

assertion.setConditions(SAMLUtils.createConditions(notBefore, notOnOrAfter));
assertion.getStatements().addAll(statements);
assertion.setID(UIDGenerator.generateUID());

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

@Override
public void createSAMLAssertion(DateTime notAfter, DateTime notBefore, String assertionId)
    throws IdentityProviderException {
  assertion = (Assertion) buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME);
  Conditions conditions = (Conditions) buildXMLObject(Conditions.DEFAULT_ELEMENT_NAME);
  conditions.setNotBefore(notBefore);
  conditions.setNotOnOrAfter(notAfter);
  ServerConfiguration config = ServerConfiguration.getInstance();
  String host = "http://" + config.getFirstProperty("HostName");
  assertion.setIssuer(host);
  assertion.setIssueInstant(new DateTime());
  if (appilesTo != null) {
    Audience audience = (Audience) buildXMLObject(Audience.DEFAULT_ELEMENT_NAME);
    audience.setUri(appilesTo);
    AudienceRestrictionCondition audienceRestrictions =
        (AudienceRestrictionCondition) buildXMLObject(AudienceRestrictionCondition.DEFAULT_ELEMENT_NAME);
    audienceRestrictions.getAudiences().add(audience);
    conditions.getAudienceRestrictionConditions().add(audienceRestrictions);
  }
  assertion.setConditions(conditions);
  assertion.getAttributeStatements().add(this.attributeStmt);
  assertion.setID(assertionId);
}

代码示例来源:origin: net.unicon.cas/cas-addons

@Override
protected void prepareResponse(final Response response, final Map<String, Object> model) {
  final Authentication authentication = getAssertionFrom(model).getChainedAuthentications().get(0);
  final DateTime issuedAt = response.getIssueInstant();
  final Service service = getAssertionFrom(model).getService();
  final Object o = authentication.getAttributes().get(RememberMeCredentials.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME);
  final boolean isRemembered = o == Boolean.TRUE && !getAssertionFrom(model).isFromNewLogin();
  // Build up the SAML assertion containing AuthenticationStatement and AttributeStatement
  final Assertion assertion = newSamlObject(Assertion.class);
  assertion.setID(generateId());
  assertion.setIssueInstant(issuedAt);
  assertion.setIssuer(this.issuer);
  assertion.setConditions(newConditions(issuedAt, service.getId()));
  final AuthenticationStatement authnStatement = newAuthenticationStatement(authentication);
  assertion.getAuthenticationStatements().add(authnStatement);
  final Map<String, Object> attributes = authentication.getPrincipal().getAttributes();
  if (!attributes.isEmpty() || isRemembered) {
    assertion.getAttributeStatements().add(
        newAttributeStatement(newSubject(authentication.getPrincipal().getId()), attributes, isRemembered));
  }
  response.setStatus(newStatus(StatusCode.SUCCESS, null));
  response.getAssertions().add(assertion);
}

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

samlAssertion.setConditions((Conditions) CommonUtil.buildXMLObject(Conditions.DEFAULT_ELEMENT_NAME));

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

saml1.setConditions(conditions);
} catch (org.opensaml.xml.security.SecurityException ex) {
  throw new WSSecurityException(

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

saml1.setConditions(conditions);
} catch (org.opensaml.xml.security.SecurityException ex) {
  throw new WSSecurityException(

相关文章