Package org.apache.ws.security.policy.parser

Examples of org.apache.ws.security.policy.parser.SecurityPolicyToken


  public Object doEncryptedElements(SecurityProcessorContext spc) {
    log.debug("Processing "
        + spc.readCurrentSecurityToken().getTokenName() + ": "
        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);

    SecurityPolicyToken spt = spc.readCurrentSecurityToken();
    switch (spc.getAction()) {

    case SecurityProcessorContext.START:
      if (!initializedEncryptedElements) {
        try {
          initializeEncryptedElements(spt);
                    SignedEncryptedElements elements = (SignedEncryptedElements) spc
                            .readCurrentPolicyEngineData();
                    PolicyEngineData parent = spc
                            .readPreviousPolicyEngineData();
                    if (parent instanceof SupportingToken) {
                        // Parent is a supporting token
                        ((SupportingToken) parent).setEncryptedElements(elements);
                    }
          initializedEncryptedElements = true;
        } catch (NoSuchMethodException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          return new Boolean(false);
        }
      }
      log.debug(spt.getTokenName());
      PrimitiveAssertion pa = spc.getAssertion();
      String text = pa.getStrValue();
      if (text != null) {
        text = text.trim();
        log.debug("Value: '" + text.toString() + "'");
View Full Code Here


   * @throws NoSuchMethodException
   */
  public void initializeUsernameToken(SecurityPolicyToken spt)
      throws NoSuchMethodException {

    SecurityPolicyToken tmpSpt = SecurityPolicy.wssUsernameToken10.copy();
    tmpSpt.setProcessTokenMethod(this);
    spt.setChildToken(tmpSpt);

    tmpSpt = SecurityPolicy.wssUsernameToken11.copy();
    tmpSpt.setProcessTokenMethod(this);
    spt.setChildToken(tmpSpt);
  }
View Full Code Here

  public Object doUsernameToken(SecurityProcessorContext spc) {
    log.debug("Processing "
        + spc.readCurrentSecurityToken().getTokenName() + ": "
        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);

    SecurityPolicyToken spt = spc.readCurrentSecurityToken();
    switch (spc.getAction()) {

    case SecurityProcessorContext.START:
      if (!initializedUsernameToken) {
        try {
          initializeUsernameToken(spt);
                    UsernameToken unt = (UsernameToken)spc.readCurrentPolicyEngineData();
                   
                    //Get the includeToken attr info
                    String includetokenUri = spc.getAssertion().getAttribute(
                            new QName(Constants.SP_NS,
                                    Constants.ATTR_INCLUDE_TOKEN));
                    try {
                        if(includetokenUri != null) { //since its optional
                            unt.setInclusion(includetokenUri);
                        }
                        ((TokenWrapper)spc.readPreviousPolicyEngineData()).setToken(unt);
                    } catch (WSSPolicyException e) {
                        log.error(e.getMessage(), e);
                        return new Boolean(false);
                    }
          initializedUsernameToken = true;
        } catch (NoSuchMethodException e) {
                    log.error(e.getMessage(), e);
                    return new Boolean(false);
        }
      }
      log.debug(spt.getTokenName());
      PrimitiveAssertion pa = spc.getAssertion();
      String text = pa.getStrValue();
      if (text != null) {
        text = text.trim();
        log.debug("Value: '" + text.toString() + "'");
View Full Code Here

   *            The token that will hold the child tokens.
   * @throws NoSuchMethodException
   */
  private void initializeSignedSupportingTokens(SecurityPolicyToken spt)
      throws NoSuchMethodException {
    SecurityPolicyToken tmpSpt = SecurityPolicy.x509Token.copy();
    tmpSpt.setProcessTokenMethod(new X509TokenProcessor());
    spt.setChildToken(tmpSpt);

    tmpSpt = SecurityPolicy.usernameToken.copy();
    tmpSpt.setProcessTokenMethod(new UsernameTokenProcessor());
    spt.setChildToken(tmpSpt);

    tmpSpt = SecurityPolicy.algorithmSuite.copy();
    tmpSpt.setProcessTokenMethod(new AlgorithmSuiteProcessor());
    spt.setChildToken(tmpSpt);

    SignedPartsElementsProcessor spep = new SignedPartsElementsProcessor();
    tmpSpt = SecurityPolicy.signedParts.copy();
    tmpSpt.setProcessTokenMethod(spep);
    spt.setChildToken(tmpSpt);

    tmpSpt = SecurityPolicy.signedElements.copy();
    tmpSpt.setProcessTokenMethod(spep);
    spt.setChildToken(tmpSpt);

    EncryptedPartsElementsProcessor epep = new EncryptedPartsElementsProcessor();
    tmpSpt = SecurityPolicy.encryptedParts.copy();
    tmpSpt.setProcessTokenMethod(epep);
    spt.setChildToken(tmpSpt);

    tmpSpt = SecurityPolicy.encryptedElements.copy();
    tmpSpt.setProcessTokenMethod(epep);
    spt.setChildToken(tmpSpt);

  }
View Full Code Here

  public Object doSignedSupportingTokens(SecurityProcessorContext spc) {
    log.debug("Processing "
        + spc.readCurrentSecurityToken().getTokenName() + ": "
        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
    SecurityPolicyToken spt = spc.readCurrentSecurityToken();

    switch (spc.getAction()) {

    case SecurityProcessorContext.START:
      if (!initializedSignedSupportingTokens) {
View Full Code Here

   *            The token that will hold the child tokens.
   * @throws NoSuchMethodException
   */
  public void initializeWss10(SecurityPolicyToken spt)
      throws NoSuchMethodException {
    SecurityPolicyToken tmpSpt = SecurityPolicy.mustSupportRefKeyIdentifier
        .copy();
    tmpSpt.setProcessTokenMethod(this);
    spt.setChildToken(tmpSpt);

    tmpSpt = SecurityPolicy.mustSupportRefIssuerSerial.copy();
    tmpSpt.setProcessTokenMethod(this);
    spt.setChildToken(tmpSpt);

    tmpSpt = SecurityPolicy.mustSupportRefExternalUri.copy();
    tmpSpt.setProcessTokenMethod(this);
    spt.setChildToken(tmpSpt);

    tmpSpt = SecurityPolicy.mustSupportRefEmbeddedToken.copy();
    tmpSpt.setProcessTokenMethod(this);
    spt.setChildToken(tmpSpt);
  }
View Full Code Here

  public Object doWss10(SecurityProcessorContext spc) {
    log.debug("Processing "
        + spc.readCurrentSecurityToken().getTokenName() + ": "
        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);

    SecurityPolicyToken spt = spc.readCurrentSecurityToken();

    switch (spc.getAction()) {

    case SecurityProcessorContext.START:
      if (!initializedWss10) {
View Full Code Here

   *            The token that will hold the child tokens.
   * @throws NoSuchMethodException
   */
  private void initializeSignatureToken(SecurityPolicyToken spt)
      throws NoSuchMethodException {
    SecurityPolicyToken tmpSpt = SecurityPolicy.x509Token.copy();
    tmpSpt.setProcessTokenMethod(new X509TokenProcessor());
    spt.setChildToken(tmpSpt);
  }
View Full Code Here

   *            The token that will hold the child tokens.
   * @throws NoSuchMethodException
   */
  private void initializeEncryptionToken(SecurityPolicyToken spt)
      throws NoSuchMethodException {
    SecurityPolicyToken tmpSpt = SecurityPolicy.x509Token.copy();
    tmpSpt.setProcessTokenMethod(new X509TokenProcessor());
    spt.setChildToken(tmpSpt);
  }
View Full Code Here

   *            The token that will hold the child tokens.
   * @throws NoSuchMethodException
   */
  private void initializeProtectionToken(SecurityPolicyToken spt)
      throws NoSuchMethodException {
    SecurityPolicyToken tmpSpt = SecurityPolicy.x509Token.copy();
    tmpSpt.setProcessTokenMethod(new X509TokenProcessor());
    spt.setChildToken(tmpSpt);
  }
View Full Code Here

TOP

Related Classes of org.apache.ws.security.policy.parser.SecurityPolicyToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.