public Assertion build(Element element, AssertionBuilderFactory factory)
      throws IllegalArgumentException {

    SPConstants consts =
        SP11Constants.SP_NS.equals(element.getNamespaceURI())
            ? SP11Constants.INSTANCE
            : SP12Constants.INSTANCE;

    RecipientSignatureToken recipientSignatureToken = new RecipientSignatureToken(consts, builder);
    recipientSignatureToken.setOptional(PolicyConstants.isOptional(element));
    recipientSignatureToken.setIgnorable(PolicyConstants.isIgnorable(element));

    Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
    policy = policy.normalize(builder.getPolicyRegistry(), false);

    for (Iterator<List<Assertion>> iterator = policy.getAlternatives(); iterator.hasNext(); ) {
      processAlternative(iterator.next(), recipientSignatureToken);
      break; // TODO process all the token that must be set ..
    }

    return recipientSignatureToken;
  }
예제 #2
0
  public PolicyAssertion build(Element element) throws IllegalArgumentException {

    SPConstants consts =
        SP11Constants.SP_NS.equals(element.getNamespaceURI())
            ? SP11Constants.INSTANCE
            : SP12Constants.INSTANCE;

    SymmetricBinding symmetricBinding = new SymmetricBinding(consts);

    Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
    policy = (Policy) policy.normalize(false);

    for (Iterator iterator = policy.getAlternatives(); iterator.hasNext(); ) {
      processAlternatives((List) iterator.next(), symmetricBinding, consts);

      /*
       * since there should be only one alternative ..
       */
      break;
    }
    return symmetricBinding;
  }
예제 #3
0
  public PolicyAssertion build(Element element) throws IllegalArgumentException {

    SPConstants consts =
        SP11Constants.SP_NS.equals(element.getNamespaceURI())
            ? SP11Constants.INSTANCE
            : SP12Constants.INSTANCE;

    RecipientToken recipientToken = new RecipientToken(consts);

    Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
    policy = (Policy) policy.normalize(false);

    for (Iterator iterator = policy.getAlternatives(); iterator.hasNext(); ) {
      processAlternative((List) iterator.next(), recipientToken);

      /*
       * for the moment we will pick the first token specified in the policy
       */
      break;
    }

    return recipientToken;
  }