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

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

本文整理了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

  1. /** {@inheritDoc} */
  2. protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
  3. throws UnmarshallingException {
  4. Assertion assertion = (Assertion) parentSAMLObject;
  5. if (childSAMLObject instanceof Signature) {
  6. assertion.setSignature((Signature) childSAMLObject);
  7. } else if (childSAMLObject instanceof Conditions) {
  8. assertion.setConditions((Conditions) childSAMLObject);
  9. } else if (childSAMLObject instanceof Advice) {
  10. assertion.setAdvice((Advice) childSAMLObject);
  11. } else if (childSAMLObject instanceof Statement) {
  12. assertion.getStatements().add((Statement) childSAMLObject);
  13. } else {
  14. super.processChildElement(parentSAMLObject, childSAMLObject);
  15. }
  16. }

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

  1. @Override
  2. public void createSAMLAssertion(DateTime notAfter, DateTime notBefore, String assertionId)
  3. throws IdentityProviderException {
  4. assertion = (Assertion) buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME);
  5. Conditions conditions = (Conditions) buildXMLObject(Conditions.DEFAULT_ELEMENT_NAME);
  6. conditions.setNotBefore(notBefore);
  7. conditions.setNotOnOrAfter(notAfter);
  8. ServerConfiguration config = ServerConfiguration.getInstance();
  9. String host = "http://" + config.getFirstProperty("HostName");
  10. assertion.setIssuer(host);
  11. assertion.setIssueInstant(new DateTime());
  12. if (appilesTo != null) {
  13. Audience audience = (Audience) buildXMLObject(Audience.DEFAULT_ELEMENT_NAME);
  14. audience.setUri(appilesTo);
  15. AudienceRestrictionCondition audienceRestrictions =
  16. (AudienceRestrictionCondition) buildXMLObject(AudienceRestrictionCondition.DEFAULT_ELEMENT_NAME);
  17. audienceRestrictions.getAudiences().add(audience);
  18. conditions.getAudienceRestrictionConditions().add(audienceRestrictions);
  19. }
  20. assertion.setConditions(conditions);
  21. assertion.getAttributeStatements().add(this.attributeStmt);
  22. assertion.setID(assertionId);
  23. }

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

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

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

  1. @Override
  2. public void createSAMLAssertion(DateTime notAfter, DateTime notBefore, String assertionId)
  3. throws IdentityProviderException {
  4. assertion = (Assertion) buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME);
  5. Conditions conditions = (Conditions) buildXMLObject(Conditions.DEFAULT_ELEMENT_NAME);
  6. conditions.setNotBefore(notBefore);
  7. conditions.setNotOnOrAfter(notAfter);
  8. ServerConfiguration config = ServerConfiguration.getInstance();
  9. String host = "http://" + config.getFirstProperty("HostName");
  10. assertion.setIssuer(host);
  11. assertion.setIssueInstant(new DateTime());
  12. if (appilesTo != null) {
  13. Audience audience = (Audience) buildXMLObject(Audience.DEFAULT_ELEMENT_NAME);
  14. audience.setUri(appilesTo);
  15. AudienceRestrictionCondition audienceRestrictions =
  16. (AudienceRestrictionCondition) buildXMLObject(AudienceRestrictionCondition.DEFAULT_ELEMENT_NAME);
  17. audienceRestrictions.getAudiences().add(audience);
  18. conditions.getAudienceRestrictionConditions().add(audienceRestrictions);
  19. }
  20. assertion.setConditions(conditions);
  21. assertion.getAttributeStatements().add(this.attributeStmt);
  22. assertion.setID(assertionId);
  23. }

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

  1. @Override
  2. protected void prepareResponse(final Response response, final Map<String, Object> model) {
  3. final Authentication authentication = getAssertionFrom(model).getChainedAuthentications().get(0);
  4. final DateTime issuedAt = response.getIssueInstant();
  5. final Service service = getAssertionFrom(model).getService();
  6. final Object o = authentication.getAttributes().get(RememberMeCredentials.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME);
  7. final boolean isRemembered = o == Boolean.TRUE && !getAssertionFrom(model).isFromNewLogin();
  8. // Build up the SAML assertion containing AuthenticationStatement and AttributeStatement
  9. final Assertion assertion = newSamlObject(Assertion.class);
  10. assertion.setID(generateId());
  11. assertion.setIssueInstant(issuedAt);
  12. assertion.setIssuer(this.issuer);
  13. assertion.setConditions(newConditions(issuedAt, service.getId()));
  14. final AuthenticationStatement authnStatement = newAuthenticationStatement(authentication);
  15. assertion.getAuthenticationStatements().add(authnStatement);
  16. final Map<String, Object> attributes = authentication.getPrincipal().getAttributes();
  17. if (!attributes.isEmpty() || isRemembered) {
  18. assertion.getAttributeStatements().add(
  19. newAttributeStatement(newSubject(authentication.getPrincipal().getId()), attributes, isRemembered));
  20. }
  21. response.setStatus(newStatus(StatusCode.SUCCESS, null));
  22. response.getAssertions().add(assertion);
  23. }

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

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

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

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

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

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

相关文章