You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2013/10/16 18:09:18 UTC

svn commit: r1532808 - in /santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax: ext/ impl/processor/output/ impl/securityToken/ securityToken/

Author: coheigea
Date: Wed Oct 16 16:09:17 2013
New Revision: 1532808

URL: http://svn.apache.org/r1532808
Log:
Refactor of "SecurityTokens"

Added:
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractSecurityToken.java
Modified:
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/OutboundXMLSec.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLEncryptOutputProcessor.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractInboundSecurityToken.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/GenericOutboundSecurityToken.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/InboundSecurityToken.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/OutboundSecurityToken.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/SecurityToken.java

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/OutboundXMLSec.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/OutboundXMLSec.java?rev=1532808&r1=1532807&r2=1532808&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/OutboundXMLSec.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/OutboundXMLSec.java Wed Oct 16 16:09:17 2013
@@ -194,7 +194,7 @@ public class OutboundXMLSec {
         }
 
         final OutboundSecurityToken transportSecurityToken =
-                new GenericOutboundSecurityToken("", SecurityTokenConstants.DefaultToken, transportKey, transportCerts);
+                new GenericOutboundSecurityToken(IDGenerator.generateID(null), SecurityTokenConstants.DefaultToken, transportKey, transportCerts);
         
         // Now sort out the session key
         Key key = securityProperties.getEncryptionKey();

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLEncryptOutputProcessor.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLEncryptOutputProcessor.java?rev=1532808&r1=1532807&r2=1532808&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLEncryptOutputProcessor.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLEncryptOutputProcessor.java Wed Oct 16 16:09:17 2013
@@ -87,7 +87,7 @@ public class XMLEncryptOutputProcessor e
                             createInternalEncryptionOutputProcessor(
                                     encryptionPartDef, xmlSecStartElement,
                                     outputProcessorChain.getDocumentContext().getEncoding(),
-                                    securityToken.getKeyWrappingToken()
+                                    (OutboundSecurityToken)securityToken.getKeyWrappingToken()
                             );
                     internalEncryptionOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
                     internalEncryptionOutputProcessor.setAction(getAction());

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractInboundSecurityToken.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractInboundSecurityToken.java?rev=1532808&r1=1532807&r2=1532808&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractInboundSecurityToken.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractInboundSecurityToken.java Wed Oct 16 16:09:17 2013
@@ -18,63 +18,53 @@
  */
 package org.apache.xml.security.stax.impl.securityToken;
 
-import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.stax.ext.InboundSecurityContext;
-import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
-import org.apache.xml.security.stax.ext.XMLSecurityConstants;
-import org.apache.xml.security.stax.securityToken.SecurityTokenConstants;
-import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
-import org.apache.xml.security.stax.securityEvent.AlgorithmSuiteSecurityEvent;
-
-import javax.crypto.SecretKey;
-import javax.xml.namespace.QName;
 import java.security.Key;
-import java.security.PrivateKey;
 import java.security.PublicKey;
-import java.security.cert.X509Certificate;
 import java.security.interfaces.DSAKey;
 import java.security.interfaces.ECKey;
 import java.security.interfaces.RSAKey;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.crypto.SecretKey;
+import javax.xml.namespace.QName;
+
+import org.apache.xml.security.exceptions.XMLSecurityException;
+import org.apache.xml.security.stax.ext.InboundSecurityContext;
+import org.apache.xml.security.stax.ext.XMLSecurityConstants;
+import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
+import org.apache.xml.security.stax.securityEvent.AlgorithmSuiteSecurityEvent;
+import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityTokenConstants;
 
 /**
  * @author $Author: coheigea $
  * @version $Revision: 1359731 $ $Date: 2012-07-10 16:39:40 +0100 (Tue, 10 Jul 2012) $
  */
-public abstract class AbstractInboundSecurityToken implements InboundSecurityToken {
+public abstract class AbstractInboundSecurityToken extends AbstractSecurityToken implements InboundSecurityToken {
 
     //prevent recursive key references
     private boolean invoked = false;
 
     private InboundSecurityContext inboundSecurityContext;
-    private final String id;
     private List<QName> elementPath;
     private XMLSecEvent xmlSecEvent;
     private SecurityTokenConstants.KeyIdentifier keyIdentifier;
     private final List<InboundSecurityToken> wrappedTokens = new ArrayList<InboundSecurityToken>();
     private InboundSecurityToken keyWrappingToken;
-    private final List<SecurityTokenConstants.TokenUsage> tokenUsages = new ArrayList<SecurityTokenConstants.TokenUsage>();
-    private final Map<String, Key> keyTable = new Hashtable<String, Key>();
-    private PublicKey publicKey;
-    private X509Certificate[] x509Certificates;
-    private boolean asymmetric = false;
     private boolean includedInMessage = false;
-    private String sha1Identifier;
 
     public AbstractInboundSecurityToken(
             InboundSecurityContext inboundSecurityContext, String id,
             SecurityTokenConstants.KeyIdentifier keyIdentifier, boolean includedInMessage) {
-
-        if (id == null || id.isEmpty()) {
-            throw new IllegalArgumentException("No id specified");
-        }
+        super(id);
 
         if (keyIdentifier == null) {
             throw new IllegalArgumentException("No keyIdentifier specified");
         }
 
         this.inboundSecurityContext = inboundSecurityContext;
-        this.id = id;
         this.keyIdentifier = keyIdentifier;
         this.includedInMessage = includedInMessage;
     }
@@ -95,11 +85,6 @@ public abstract class AbstractInboundSec
     }
 
     @Override
-    public String getId() {
-        return this.id;
-    }
-
-    @Override
     public List<QName> getElementPath() {
         return elementPath;
     }
@@ -117,28 +102,6 @@ public abstract class AbstractInboundSec
         this.xmlSecEvent = xmlSecEvent;
     }
 
-    @Override
-    public boolean isAsymmetric() throws XMLSecurityException {
-        return asymmetric;
-    }
-
-    public void setSecretKey(String algorithmURI, Key key) {
-        if (algorithmURI == null) {
-            throw new IllegalArgumentException("algorithmURI must not be null");
-        }
-        if (key != null) {
-            this.keyTable.put(algorithmURI, key);
-        }
-        if (key instanceof PrivateKey) {
-            this.asymmetric = true;
-        }
-    }
-
-    @Override
-    public Map<String, Key> getSecretKey() throws XMLSecurityException {
-        return Collections.unmodifiableMap(keyTable);
-    }
-
     protected Key getKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage algorithmUsage,
                          String correlationID) throws XMLSecurityException {
         if (algorithmURI == null) {
@@ -186,23 +149,6 @@ public abstract class AbstractInboundSec
         return key;
     }
 
-    public void setPublicKey(PublicKey publicKey) {
-        this.publicKey = publicKey;
-        this.asymmetric = true;
-    }
-
-    @Override
-    public PublicKey getPublicKey() throws XMLSecurityException {
-        if (this.publicKey != null) {
-            return this.publicKey;
-        }
-        X509Certificate[] x509Certificates = getX509Certificates();
-        if (x509Certificates != null && x509Certificates.length > 0) {
-            this.publicKey = x509Certificates[0].getPublicKey();
-        }
-        return this.publicKey;
-    }
-
     protected PublicKey getPubKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage algorithmUsage,
                                   String correlationID) throws XMLSecurityException {
         return getPublicKey();
@@ -236,15 +182,6 @@ public abstract class AbstractInboundSec
         return publicKey;
     }
 
-    public void setX509Certificates(X509Certificate[] x509Certificates) {
-        this.x509Certificates = x509Certificates;
-    }
-
-    @Override
-    public X509Certificate[] getX509Certificates() throws XMLSecurityException {
-        return x509Certificates;
-    }
-
     @Override
     public void verify() throws XMLSecurityException {
     }
@@ -272,11 +209,6 @@ public abstract class AbstractInboundSec
     }
 
     @Override
-    public List<SecurityTokenConstants.TokenUsage> getTokenUsages() {
-        return tokenUsages;
-    }
-
-    @Override
     public InboundSecurityToken getKeyWrappingToken() throws XMLSecurityException {
         return keyWrappingToken;
     }
@@ -289,12 +221,5 @@ public abstract class AbstractInboundSec
     public boolean isIncludedInMessage() {
         return includedInMessage;
     }
-
-    public String getSha1Identifier() {
-        return sha1Identifier;
-    }
-
-    public void setSha1Identifier(String sha1Identifier) {
-        this.sha1Identifier = sha1Identifier;
-    }
+    
 }

Added: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractSecurityToken.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractSecurityToken.java?rev=1532808&view=auto
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractSecurityToken.java (added)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/AbstractSecurityToken.java Wed Oct 16 16:09:17 2013
@@ -0,0 +1,134 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.xml.security.stax.impl.securityToken;
+
+import java.security.Key;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.xml.security.exceptions.XMLSecurityException;
+import org.apache.xml.security.stax.securityToken.SecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityTokenConstants;
+import org.apache.xml.security.stax.securityToken.SecurityTokenConstants.TokenUsage;
+
+/**
+ * @author $Author: coheigea $
+ * @version $Revision: 1359731 $ $Date: 2012-07-10 16:39:40 +0100 (Tue, 10 Jul 2012) $
+ */
+public abstract class AbstractSecurityToken implements SecurityToken {
+
+    private final String id;
+    private PublicKey publicKey;
+    private X509Certificate[] x509Certificates;
+    private boolean asymmetric = false;
+    private String sha1Identifier;
+    
+    protected final Map<String, Key> keyTable = new Hashtable<String, Key>();
+    protected final List<SecurityTokenConstants.TokenUsage> tokenUsages = new ArrayList<SecurityTokenConstants.TokenUsage>();
+    
+    public AbstractSecurityToken(String id) {
+        if (id == null || id.isEmpty()) {
+            throw new IllegalArgumentException("No id specified");
+        }
+
+
+        this.id = id;
+    }
+
+    @Override
+    public String getId() {
+        return this.id;
+    }
+    
+    protected void setAsymmetric(boolean asymmetric) {
+        this.asymmetric = asymmetric;
+    }
+
+    @Override
+    public boolean isAsymmetric() throws XMLSecurityException {
+        return asymmetric;
+    }
+
+    public void setSecretKey(String algorithmURI, Key key) {
+        if (algorithmURI == null) {
+            throw new IllegalArgumentException("algorithmURI must not be null");
+        }
+        if (key != null) {
+            this.keyTable.put(algorithmURI, key);
+        }
+        if (key instanceof PrivateKey) {
+            this.asymmetric = true;
+        }
+    }
+
+    @Override
+    public Map<String, Key> getSecretKey() throws XMLSecurityException {
+        return Collections.unmodifiableMap(keyTable);
+    }
+
+    public void setPublicKey(PublicKey publicKey) {
+        this.publicKey = publicKey;
+        this.asymmetric = true;
+    }
+
+    @Override
+    public PublicKey getPublicKey() throws XMLSecurityException {
+        if (this.publicKey != null) {
+            return this.publicKey;
+        }
+        X509Certificate[] x509Certificates = getX509Certificates();
+        if (x509Certificates != null && x509Certificates.length > 0) {
+            this.publicKey = x509Certificates[0].getPublicKey();
+        }
+        return this.publicKey;
+    }
+
+    public void setX509Certificates(X509Certificate[] x509Certificates) {
+        this.x509Certificates = x509Certificates;
+    }
+
+    @Override
+    public X509Certificate[] getX509Certificates() throws XMLSecurityException {
+        return x509Certificates;
+    }
+    
+    @Override
+    public void addTokenUsage(TokenUsage tokenUsage) throws XMLSecurityException {
+        tokenUsages.add(tokenUsage);
+    }
+
+    @Override
+    public List<SecurityTokenConstants.TokenUsage> getTokenUsages() {
+        return tokenUsages;
+    }
+
+    public String getSha1Identifier() {
+        return sha1Identifier;
+    }
+
+    public void setSha1Identifier(String sha1Identifier) {
+        this.sha1Identifier = sha1Identifier;
+    }
+}

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/GenericOutboundSecurityToken.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/GenericOutboundSecurityToken.java?rev=1532808&r1=1532807&r2=1532808&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/GenericOutboundSecurityToken.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/securityToken/GenericOutboundSecurityToken.java Wed Oct 16 16:09:17 2013
@@ -18,34 +18,31 @@
  */
 package org.apache.xml.security.stax.impl.securityToken;
 
+import java.security.Key;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.securityToken.OutboundSecurityToken;
 import org.apache.xml.security.stax.securityToken.SecurityTokenConstants;
-
-import java.security.Key;
-import java.security.PublicKey;
-import java.security.cert.X509Certificate;
-import java.util.*;
+import org.apache.xml.security.stax.securityToken.SecurityTokenConstants.KeyIdentifier;
 
 /**
  * @author $Author: $
  * @version $Revision: $ $Date: $
  */
-public class GenericOutboundSecurityToken implements OutboundSecurityToken {
+public class GenericOutboundSecurityToken extends AbstractSecurityToken implements OutboundSecurityToken {
 
-    private String id;
     private SecurityTokenConstants.TokenType tokenType;
     private Object processor;
     private final List<OutboundSecurityToken> wrappedTokens = new ArrayList<OutboundSecurityToken>();
     private OutboundSecurityToken keyWrappingToken;
-    private final Map<String, Key> keyTable = new Hashtable<String, Key>();
-    private PublicKey publicKey;
-    private X509Certificate[] x509Certificates;
-    private String sha1Identifier;
 
     public GenericOutboundSecurityToken(String id, SecurityTokenConstants.TokenType tokenType, Key key, X509Certificate[] x509Certificates) {
         this(id, tokenType, key);
-        this.x509Certificates = x509Certificates;
+        setX509Certificates(x509Certificates);
     }
 
     public GenericOutboundSecurityToken(String id, SecurityTokenConstants.TokenType tokenType, Key key) {
@@ -54,16 +51,11 @@ public class GenericOutboundSecurityToke
     }
 
     public GenericOutboundSecurityToken(String id, SecurityTokenConstants.TokenType tokenType) {
-        this.id = id;
+        super(id);
         this.tokenType = tokenType;
     }
 
     @Override
-    public String getId() {
-        return id;
-    }
-
-    @Override
     public Object getProcessor() {
         return processor;
     }
@@ -85,31 +77,6 @@ public class GenericOutboundSecurityToke
         return key;
     }
 
-    public void setSecretKey(String algorithmURI, Key key) {
-        if (algorithmURI == null) {
-            throw new IllegalArgumentException("algorithmURI must not be null");
-        }
-        if (key != null) {
-            this.keyTable.put(algorithmURI, key);
-        }
-    }
-
-    @Override
-    public PublicKey getPublicKey() throws XMLSecurityException {
-        if (this.publicKey != null) {
-            return this.publicKey;
-        }
-        if (this.x509Certificates != null && this.x509Certificates.length > 0) {
-            return this.publicKey = this.x509Certificates[0].getPublicKey();
-        }
-        return null;
-    }
-
-    @Override
-    public X509Certificate[] getX509Certificates() throws XMLSecurityException {
-        return this.x509Certificates;
-    }
-
     @Override
     public OutboundSecurityToken getKeyWrappingToken() throws XMLSecurityException {
         return keyWrappingToken;
@@ -129,16 +96,19 @@ public class GenericOutboundSecurityToke
         wrappedTokens.add(securityToken);
     }
 
+    public void setTokenType(SecurityTokenConstants.TokenType tokenType) {
+        this.tokenType = tokenType;
+    }
+    
     @Override
     public SecurityTokenConstants.TokenType getTokenType() {
         return tokenType;
     }
-    
-    public String getSha1Identifier() {
-        return sha1Identifier;
-    }
 
-    public void setSha1Identifier(String sha1Identifier) {
-        this.sha1Identifier = sha1Identifier;
+    @Override
+    public KeyIdentifier getKeyIdentifier() {
+        // TODO Auto-generated method stub
+        return null;
     }
+
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/InboundSecurityToken.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/InboundSecurityToken.java?rev=1532808&r1=1532807&r2=1532808&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/InboundSecurityToken.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/InboundSecurityToken.java Wed Oct 16 16:09:17 2013
@@ -18,13 +18,16 @@
  */
 package org.apache.xml.security.stax.securityToken;
 
-import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.stax.ext.XMLSecurityConstants;
-
 import java.security.Key;
 import java.security.PublicKey;
 import java.util.List;
 
+import javax.xml.namespace.QName;
+
+import org.apache.xml.security.exceptions.XMLSecurityException;
+import org.apache.xml.security.stax.ext.XMLSecurityConstants;
+import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
+
 /**
  * This class represents the different token types which can occur in WS-Security
  * <p/>
@@ -56,23 +59,33 @@ public interface InboundSecurityToken ex
      */
     PublicKey getPublicKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage algorithmUsage, String correlationID) throws XMLSecurityException;
 
+    void addWrappedToken(InboundSecurityToken securityToken);
+    
     /**
      * Verifies the key if applicable
      *
      * @throws XMLSecurityException if the key couldn't be verified or the key isn't valid
      */
     void verify() throws XMLSecurityException;
-
+    
     /**
-     * Returns the key wrapping token
+     * Returns the absolute path to the XMLElement
      *
-     * @return The wrapping SecurityToken
+     * @return A list containing full qualified element names
      */
-    InboundSecurityToken getKeyWrappingToken() throws XMLSecurityException;
+    List<QName> getElementPath();
 
-    void addWrappedToken(InboundSecurityToken securityToken);
+    /**
+     * Returns the first XMLEvent for this token
+     *
+     * @return
+     */
+    XMLSecEvent getXMLSecEvent();
 
-    List<? extends InboundSecurityToken> getWrappedTokens() throws XMLSecurityException;
+    /**
+     * Returns if the token is included in the message or not
+     * @return true if the token is included false otherwise
+     */
+    boolean isIncludedInMessage();
 
-    void addTokenUsage(SecurityTokenConstants.TokenUsage tokenUsage) throws XMLSecurityException;
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/OutboundSecurityToken.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/OutboundSecurityToken.java?rev=1532808&r1=1532807&r2=1532808&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/OutboundSecurityToken.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/OutboundSecurityToken.java Wed Oct 16 16:09:17 2013
@@ -18,25 +18,15 @@
  */
 package org.apache.xml.security.stax.securityToken;
 
-import org.apache.xml.security.exceptions.XMLSecurityException;
-
 import java.security.Key;
-import java.security.PublicKey;
-import java.security.cert.X509Certificate;
-import java.util.List;
+
+import org.apache.xml.security.exceptions.XMLSecurityException;
 
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
-public interface OutboundSecurityToken {
-
-    /**
-     * Returns the token id aka wsu:Id
-     *
-     * @return The id
-     */
-    String getId();
+public interface OutboundSecurityToken extends SecurityToken {
 
     /**
      * Returns the responsible processor for this token
@@ -52,38 +42,7 @@ public interface OutboundSecurityToken {
      * @throws XMLSecurityException if the key can't be loaded
      */
     Key getSecretKey(String algorithmURI) throws XMLSecurityException;
-
-    /**
-     * Returns the public key if one exists and already initialized, null otherwise
-     * @return
-     * @throws org.apache.xml.security.exceptions.XMLSecurityException
-     */
-    PublicKey getPublicKey() throws XMLSecurityException;
-
-    /**
-     * Returns the certificate chain if one exists for this token type
-     *
-     * @return The certificate chain
-     * @throws org.apache.xml.security.exceptions.XMLSecurityException if the certificates can't be retrieved
-     */
-    X509Certificate[] getX509Certificates() throws XMLSecurityException;
-
-    /**
-     * Returns the key wrapping token
-     *
-     * @return The wrapping SecurityToken
-     */
-    OutboundSecurityToken getKeyWrappingToken() throws XMLSecurityException;
-
-    List<OutboundSecurityToken> getWrappedTokens() throws XMLSecurityException;
-
+    
     void addWrappedToken(OutboundSecurityToken securityToken);
 
-    SecurityTokenConstants.TokenType getTokenType();
-    
-    /**
-     * Returns a SHA-1 Identifier that refers to this token
-     * @return a SHA-1 Identifier that refers to this token
-     */
-    String getSha1Identifier();
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/SecurityToken.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/SecurityToken.java?rev=1532808&r1=1532807&r2=1532808&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/SecurityToken.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/securityToken/SecurityToken.java Wed Oct 16 16:09:17 2013
@@ -18,16 +18,14 @@
  */
 package org.apache.xml.security.stax.securityToken;
 
-import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
-
-import javax.xml.namespace.QName;
 import java.security.Key;
 import java.security.PublicKey;
 import java.security.cert.X509Certificate;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.xml.security.exceptions.XMLSecurityException;
+
 /**
  * External view to a SecurityToken
  */
@@ -76,7 +74,7 @@ public interface SecurityToken {
     SecurityToken getKeyWrappingToken() throws XMLSecurityException;
 
     List<? extends SecurityToken> getWrappedTokens() throws XMLSecurityException;
-
+    
     /**
      * Returns the KeyIdentifier
      *
@@ -87,27 +85,9 @@ public interface SecurityToken {
     SecurityTokenConstants.TokenType getTokenType();
 
     List<SecurityTokenConstants.TokenUsage> getTokenUsages();
-
-    /**
-     * Returns the absolute path to the XMLElement
-     *
-     * @return A list containing full qualified element names
-     */
-    List<QName> getElementPath();
-
-    /**
-     * Returns the first XMLEvent for this token
-     *
-     * @return
-     */
-    XMLSecEvent getXMLSecEvent();
-
-    /**
-     * Returns if the token is included in the message or not
-     * @return true if the token is included false otherwise
-     */
-    boolean isIncludedInMessage();
     
+    void addTokenUsage(SecurityTokenConstants.TokenUsage tokenUsage) throws XMLSecurityException;
+
     /**
      * Returns a SHA-1 Identifier that refers to this token
      * @return a SHA-1 Identifier that refers to this token