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

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

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

Assertion.setAdvice介绍

[英]Sets the Advice for this assertion.
[中]设置此断言的建议。

代码示例

代码示例来源:origin: net.shibboleth.idp/idp-saml-impl

/** {@inheritDoc} */
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
  final DelegationPolicy delegationPolicy = (DelegationPolicy) XMLObjectSupport.buildXMLObject(
      DelegationPolicy.DEFAULT_ELEMENT_NAME);
  delegationPolicy.setMaximumTokenDelegationChainLength(maxChainLength);
  
  if (assertion.getAdvice() == null) {
    assertion.setAdvice((Advice) XMLObjectSupport.buildXMLObject(Advice.DEFAULT_ELEMENT_NAME));
  }
  
  assertion.getAdvice().getChildren().add(delegationPolicy);
}

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

/**
 * Creates and adds a {@link Advice} to a given {@link Assertion}. If the {@link Assertion} already contains an
 * {@link Advice} this method just returns.
 * 
 * @param action current action
 * @param assertion assertion to which the advice will be added
 * 
 * @return the {@link Advice} that already existed on, or the one that was added to, the {@link Assertion}
 */
@Nonnull public static Advice addAdviceToAssertion(@Nonnull final AbstractProfileAction action,
    @Nonnull final Assertion assertion) {
  Advice advice = assertion.getAdvice();
  if (advice == null) {
    final SAMLObjectBuilder<Advice> adviceBuilder = (SAMLObjectBuilder<Advice>)
        XMLObjectProviderRegistrySupport.getBuilderFactory().<Advice>getBuilderOrThrow(
            Advice.DEFAULT_ELEMENT_NAME);
    advice = adviceBuilder.buildObject();
    assertion.setAdvice(advice);
    getLogger().debug("Profile Action {}: Assertion {} did not already contain Advice, one was added",
        action.getClass().getSimpleName(), assertion.getID());
  } else {
    getLogger().debug("Profile Action {}: Assertion {} already contained Advice, nothing was done",
        action.getClass().getSimpleName(), assertion.getID());
  }
  return advice;
}

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

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

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

org.opensaml.saml.saml2.core.Advice advice =
  SAML2ComponentBuilder.createAdvice(samlCallback.getAdvice());
saml2.setAdvice(advice);

相关文章