ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gi...@apache.org
Subject svn commit: r1463136 [7/11] - in /webservices/wss4j/trunk: cxf-integration/src/main/java/org/apache/wss4j/cxfIntegration/interceptor/ integration/src/test/java/org/apache/wss4j/integration/test/stax/ ws-security-common/src/main/java/org/apache/wss4j/co...
Date Mon, 01 Apr 2013 13:57:35 GMT
Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java Mon Apr  1 13:57:32 2013
@@ -25,11 +25,14 @@ import org.apache.wss4j.common.ext.WSSec
 import org.apache.wss4j.common.saml.OpenSAMLUtil;
 import org.apache.wss4j.common.saml.SAMLUtil;
 import org.apache.wss4j.common.saml.SamlAssertionWrapper;
+import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.wss4j.stax.ext.WSSUtils;
-import org.apache.wss4j.stax.ext.WSSecurityContext;
-import org.apache.wss4j.stax.impl.securityToken.InboundSecurityTokenImpl;
+import org.apache.wss4j.stax.securityEvent.WSSecurityEventConstants;
+import org.apache.wss4j.stax.securityToken.SamlSecurityToken;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
+import org.apache.wss4j.stax.impl.securityToken.SamlSecurityTokenImpl;
 import org.apache.wss4j.stax.securityEvent.SamlTokenSecurityEvent;
 import org.apache.wss4j.stax.validate.SamlTokenValidator;
 import org.apache.wss4j.stax.validate.SamlTokenValidatorImpl;
@@ -46,11 +49,14 @@ import org.apache.xml.security.stax.ext.
 import org.apache.xml.security.stax.ext.stax.XMLSecNamespace;
 import org.apache.xml.security.stax.ext.stax.XMLSecStartElement;
 import org.apache.xml.security.stax.impl.XMLSecurityEventReader;
-import org.apache.xml.security.stax.impl.securityToken.SecurityTokenFactory;
+import org.apache.xml.security.stax.impl.securityToken.AbstractInboundSecurityToken;
 import org.apache.xml.security.stax.securityEvent.SecurityEvent;
-import org.apache.xml.security.stax.securityEvent.SecurityEventConstants;
 import org.apache.xml.security.stax.securityEvent.SecurityEventListener;
 import org.apache.xml.security.stax.securityEvent.SignedElementSecurityEvent;
+import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityTokenFactory;
+import org.apache.xml.security.stax.securityToken.SecurityTokenProvider;
 import org.opensaml.xml.security.x509.BasicX509Credential;
 import org.opensaml.xml.signature.Signature;
 import org.opensaml.xml.signature.SignatureValidator;
@@ -100,7 +106,7 @@ public class SAMLTokenInputHandler exten
         final Document samlTokenDocument = (Document) parseStructure(eventQueue, index, securityProperties);
 
         final WSSSecurityProperties wssSecurityProperties = (WSSSecurityProperties) securityProperties;
-        final WSSecurityContext wsSecurityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
+        final WSInboundSecurityContext wsInboundSecurityContext = (WSInboundSecurityContext) inputProcessorChain.getSecurityContext();
         final Element samlElement = samlTokenDocument.getDocumentElement();
         final SamlAssertionWrapper samlAssertionWrapper = new SamlAssertionWrapper(samlElement);
 
@@ -121,7 +127,7 @@ public class SAMLTokenInputHandler exten
             if (sigKeyInfoIdx < 0) {
                 throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN, "noKeyInSAMLToken");
             }
-            SecurityToken sigSecurityToken = parseKeyInfo(inputProcessorChain, securityProperties, eventQueue, sigKeyInfoIdx);
+            InboundSecurityToken sigSecurityToken = parseKeyInfo(inputProcessorChain, securityProperties, eventQueue, sigKeyInfoIdx);
 
             if (sigSecurityToken == null) {
                 throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN, "noKeyInSAMLToken");
@@ -155,7 +161,7 @@ public class SAMLTokenInputHandler exten
             confirmMethod = methods.get(0);
         }
 
-        final SecurityToken subjectSecurityToken;
+        final InboundSecurityToken subjectSecurityToken;
 
         if (OpenSAMLUtil.isMethodHolderOfKey(confirmMethod)) {
 
@@ -165,12 +171,12 @@ public class SAMLTokenInputHandler exten
 
             if (subjectSecretKey != null && subjectSecretKey.length > 0) {
 
-                subjectSecurityToken = new InboundSecurityTokenImpl(
-                        wsSecurityContext, "",
-                        XMLSecurityConstants.XMLKeyIdentifierType.NO_KEY_INFO) {
+                subjectSecurityToken = new AbstractInboundSecurityToken(
+                        wsInboundSecurityContext, "",
+                        WSSecurityTokenConstants.KeyIdentifier_NoKeyInfo) {
                     @Override
-                    public XMLSecurityConstants.TokenType getTokenType() {
-                        return XMLSecurityConstants.DefaultToken;
+                    public WSSecurityTokenConstants.TokenType getTokenType() {
+                        return WSSecurityTokenConstants.DefaultToken;
                     }
 
                     @Override
@@ -179,10 +185,10 @@ public class SAMLTokenInputHandler exten
                     }
 
                     @Override
-                    protected Key getKey(String algorithmURI, XMLSecurityConstants.KeyUsage
-                            keyUsage, String correlationID) throws XMLSecurityException {
+                    protected Key getKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage
+                            algorithmUsage, String correlationID) throws XMLSecurityException {
 
-                        Key key = super.getKey(algorithmURI, keyUsage, correlationID);
+                        Key key = super.getKey(algorithmURI, algorithmUsage, correlationID);
                         if (key == null) {
                             String algoFamily = JCEAlgorithmMapper.getJCERequiredKeyFromURI(algorithmURI);
                             key = new SecretKeySpec(subjectSecretKey, algoFamily);
@@ -213,17 +219,24 @@ public class SAMLTokenInputHandler exten
 
         final List<XMLSecEvent> xmlSecEvents = getResponsibleXMLSecEvents(eventQueue, index);
         final List<QName> elementPath = getElementPath(eventQueue);
-        final TokenContext tokenContext = new TokenContext(wssSecurityProperties, wsSecurityContext, xmlSecEvents, elementPath);
+        final TokenContext tokenContext = new TokenContext(wssSecurityProperties, wsInboundSecurityContext, xmlSecEvents, elementPath);
 
-        final SecurityToken securityToken = samlTokenValidator.validate(
-                samlAssertionWrapper, subjectSecurityToken, tokenContext);
+        //jdk 1.6 compiler bug? http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302954
+        //type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with
+        // upper bounds org.apache.wss4j.stax.securityToken.SamlSecurityToken,
+        // org.apache.wss4j.stax.securityToken.SamlSecurityToken,
+        // org.apache.xml.security.stax.ext.securityToken.InboundSecurityToken
+        //works fine on jdk 1.7
+        final SamlSecurityToken samlSecurityToken =
+                samlTokenValidator.</*fake @see above*/SamlSecurityTokenImpl>
+                        validate(samlAssertionWrapper, subjectSecurityToken, tokenContext);
 
-        SecurityTokenProvider subjectSecurityTokenProvider = new SecurityTokenProvider() {
+        SecurityTokenProvider<InboundSecurityToken> subjectSecurityTokenProvider =
+                new SecurityTokenProvider<InboundSecurityToken>() {
 
-            @SuppressWarnings("unchecked")
             @Override
-            public SecurityToken getSecurityToken() throws XMLSecurityException {
-                return securityToken;
+            public InboundSecurityToken getSecurityToken() throws XMLSecurityException {
+                return (InboundSecurityToken)samlSecurityToken;
             }
 
             @Override
@@ -232,17 +245,18 @@ public class SAMLTokenInputHandler exten
             }
         };
 
-        wsSecurityContext.registerSecurityTokenProvider(samlAssertionWrapper.getId(), subjectSecurityTokenProvider);
+        wsInboundSecurityContext.registerSecurityTokenProvider(samlAssertionWrapper.getId(), subjectSecurityTokenProvider);
 
         //fire a tokenSecurityEvent
         SamlTokenSecurityEvent samlTokenSecurityEvent = new SamlTokenSecurityEvent();
-        samlTokenSecurityEvent.setSecurityToken((SecurityToken) subjectSecurityTokenProvider.getSecurityToken());
+        samlTokenSecurityEvent.setSecurityToken((SamlSecurityToken)subjectSecurityTokenProvider.getSecurityToken());
         samlTokenSecurityEvent.setCorrelationID(samlAssertionWrapper.getId());
-        wsSecurityContext.registerSecurityEvent(samlTokenSecurityEvent);
+        wsInboundSecurityContext.registerSecurityEvent(samlTokenSecurityEvent);
 
         SAMLTokenVerifierInputProcessor samlTokenVerifierInputProcessor =
-                new SAMLTokenVerifierInputProcessor(securityProperties, samlAssertionWrapper, subjectSecurityTokenProvider, subjectSecurityToken);
-        wsSecurityContext.addSecurityEventListener(samlTokenVerifierInputProcessor);
+                new SAMLTokenVerifierInputProcessor(
+                        securityProperties, samlAssertionWrapper, subjectSecurityTokenProvider, subjectSecurityToken);
+        wsInboundSecurityContext.addSecurityEventListener(samlTokenVerifierInputProcessor);
         inputProcessorChain.addProcessor(samlTokenVerifierInputProcessor);
     }
 
@@ -300,7 +314,7 @@ public class SAMLTokenInputHandler exten
         return idx;
     }
 
-    private SecurityToken parseKeyInfo(InputProcessorChain inputProcessorChain, XMLSecurityProperties securityProperties,
+    private InboundSecurityToken parseKeyInfo(InputProcessorChain inputProcessorChain, XMLSecurityProperties securityProperties,
                                        Deque<XMLSecEvent> eventQueue, int index) throws XMLSecurityException {
         XMLSecEvent xmlSecEvent = null;
         int idx = 0;
@@ -342,12 +356,12 @@ public class SAMLTokenInputHandler exten
                 }
             }
 
-            return new InboundSecurityTokenImpl(
+            return new AbstractInboundSecurityToken(
                     inputProcessorChain.getSecurityContext(), "",
-                    XMLSecurityConstants.XMLKeyIdentifierType.NO_KEY_INFO) {
+                    WSSecurityTokenConstants.KeyIdentifier_NoKeyInfo) {
                 @Override
-                public XMLSecurityConstants.TokenType getTokenType() {
-                    return XMLSecurityConstants.DefaultToken;
+                public WSSecurityTokenConstants.TokenType getTokenType() {
+                    return WSSecurityTokenConstants.DefaultToken;
                 }
 
                 @Override
@@ -356,9 +370,9 @@ public class SAMLTokenInputHandler exten
                 }
 
                 @Override
-                protected Key getKey(String algorithmURI, XMLSecurityConstants.KeyUsage keyUsage, String correlationID)
+                protected Key getKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage algorithmUsage, String correlationID)
                         throws XMLSecurityException {
-                    Key key = super.getKey(algorithmURI, keyUsage, correlationID);
+                    Key key = super.getKey(algorithmURI, algorithmUsage, correlationID);
                     if (key == null) {
                         String algoFamily = JCEAlgorithmMapper.getJCERequiredKeyFromURI(algorithmURI);
                         key = new SecretKeySpec(Base64.decodeBase64(stringBuilder.toString()), algoFamily);
@@ -408,7 +422,7 @@ public class SAMLTokenInputHandler exten
             }
 
             return SecurityTokenFactory.getInstance().getSecurityToken(
-                    keyInfoType, SecurityToken.KeyInfoUsage.SIGNATURE_VERIFICATION,
+                    keyInfoType, WSSecurityTokenConstants.KeyUsage_Signature_Verification,
                     securityProperties, inputProcessorChain.getSecurityContext());
         }
     }
@@ -543,13 +557,13 @@ public class SAMLTokenInputHandler exten
     class SAMLTokenVerifierInputProcessor extends AbstractInputProcessor implements SecurityEventListener {
 
         private SamlAssertionWrapper samlAssertionWrapper;
-        private SecurityTokenProvider securityTokenProvider;
-        private SecurityToken subjectSecurityToken;
+        private SecurityTokenProvider<InboundSecurityToken> securityTokenProvider;
+        private InboundSecurityToken subjectSecurityToken;
         private List<SignedElementSecurityEvent> samlTokenSignedElementSecurityEvents = new ArrayList<SignedElementSecurityEvent>();
         private SignedElementSecurityEvent bodySignedElementSecurityEvent;
 
         SAMLTokenVerifierInputProcessor(XMLSecurityProperties securityProperties, SamlAssertionWrapper samlAssertionWrapper,
-                                        SecurityTokenProvider securityTokenProvider, SecurityToken subjectSecurityToken) {
+                                        SecurityTokenProvider<InboundSecurityToken> securityTokenProvider, InboundSecurityToken subjectSecurityToken) {
             super(securityProperties);
             this.setPhase(XMLSecurityConstants.Phase.POSTPROCESSING);
             this.addAfterProcessor(OperationInputProcessor.class.getName());
@@ -560,7 +574,7 @@ public class SAMLTokenInputHandler exten
 
         @Override
         public void registerSecurityEvent(SecurityEvent securityEvent) throws XMLSecurityException {
-            if (securityEvent.getSecurityEventType() == SecurityEventConstants.SignedElement) {
+            if (WSSecurityEventConstants.SignedElement.equals(securityEvent.getSecurityEventType())) {
                 SignedElementSecurityEvent signedElementSecurityEvent = (SignedElementSecurityEvent) securityEvent;
 
                 List<QName> elementPath = signedElementSecurityEvent.getElementPath();
@@ -596,12 +610,12 @@ public class SAMLTokenInputHandler exten
 
         private void checkPossessionOfKey(
                 InputProcessorChain inputProcessorChain, SamlAssertionWrapper samlAssertionWrapper,
-                SecurityToken subjectSecurityToken) throws WSSecurityException {
+                InboundSecurityToken subjectSecurityToken) throws WSSecurityException {
 
             try {
                 SecurityToken httpsSecurityToken = getHttpsSecurityToken(inputProcessorChain);
 
-                List<SecurityTokenProvider> securityTokenProviders =
+                List<SecurityTokenProvider<? extends InboundSecurityToken>> securityTokenProviders =
                         inputProcessorChain.getSecurityContext().getRegisteredSecurityTokenProviders();
 
                 List<String> confirmationMethods = samlAssertionWrapper.getConfirmationMethods();
@@ -642,8 +656,8 @@ public class SAMLTokenInputHandler exten
                             }
                         } else {
                             for (int j = 0; j < securityTokenProviders.size(); j++) {
-                                SecurityTokenProvider securityTokenProvider = securityTokenProviders.get(j);
-                                SecurityToken securityToken = securityTokenProvider.getSecurityToken();
+                                SecurityTokenProvider<? extends InboundSecurityToken> securityTokenProvider = securityTokenProviders.get(j);
+                                InboundSecurityToken securityToken = securityTokenProvider.getSecurityToken();
                                 if (securityToken == httpsSecurityToken) {
                                     continue;
                                 }
@@ -685,7 +699,7 @@ public class SAMLTokenInputHandler exten
                         SignedElementSecurityEvent samlTokenSignedElementSecurityEvent = null;
                         for (int j = 0; j < samlTokenSignedElementSecurityEvents.size(); j++) {
                             SignedElementSecurityEvent signedElementSecurityEvent = samlTokenSignedElementSecurityEvents.get(j);
-                            if (((SecurityToken) securityTokenProvider.getSecurityToken()).getXMLSecEvent() ==
+                            if (securityTokenProvider.getSecurityToken().getXMLSecEvent() ==
                                     signedElementSecurityEvent.getXmlSecEvent()) {
 
                                 samlTokenSignedElementSecurityEvent = signedElementSecurityEvent;
@@ -707,12 +721,12 @@ public class SAMLTokenInputHandler exten
         }
 
         private SecurityToken getHttpsSecurityToken(InputProcessorChain inputProcessorChain) throws XMLSecurityException {
-            List<SecurityTokenProvider> securityTokenProviders =
+            List<SecurityTokenProvider<? extends InboundSecurityToken>> securityTokenProviders =
                     inputProcessorChain.getSecurityContext().getRegisteredSecurityTokenProviders();
             for (int i = 0; i < securityTokenProviders.size(); i++) {
-                SecurityTokenProvider securityTokenProvider = securityTokenProviders.get(i);
+                SecurityTokenProvider<? extends InboundSecurityToken> securityTokenProvider = securityTokenProviders.get(i);
                 SecurityToken securityToken = securityTokenProvider.getSecurityToken();
-                if (securityToken.getTokenType() == WSSConstants.HttpsToken) {
+                if (WSSecurityTokenConstants.HttpsToken.equals(securityToken.getTokenType())) {
                     return securityToken;
                 }
             }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityContextTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityContextTokenInputHandler.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityContextTokenInputHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityContextTokenInputHandler.java Mon Apr  1 13:57:32 2013
@@ -19,9 +19,9 @@
 package org.apache.wss4j.stax.impl.processor.input;
 
 import org.apache.wss4j.binding.wssc.AbstractSecurityContextTokenType;
+import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
-import org.apache.wss4j.stax.ext.WSSecurityContext;
 import org.apache.wss4j.stax.securityEvent.SecurityContextTokenSecurityEvent;
 import org.apache.wss4j.stax.validate.SecurityContextTokenValidator;
 import org.apache.wss4j.stax.validate.SecurityContextTokenValidatorImpl;
@@ -30,6 +30,8 @@ import org.apache.xml.security.exception
 import org.apache.xml.security.stax.ext.*;
 import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
 import org.apache.xml.security.stax.impl.util.IDGenerator;
+import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityTokenProvider;
 
 import javax.xml.bind.JAXBElement;
 import javax.xml.namespace.QName;
@@ -58,25 +60,25 @@ public class SecurityContextTokenInputHa
         final String identifier = (String) XMLSecurityUtils.getQNameType(securityContextTokenType.getAny(),
                 elementName);
 
-        final WSSecurityContext wsSecurityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
+        final WSInboundSecurityContext wsInboundSecurityContext = (WSInboundSecurityContext) inputProcessorChain.getSecurityContext();
         final WSSSecurityProperties wssSecurityProperties = (WSSSecurityProperties) securityProperties;
         final List<XMLSecEvent> xmlSecEvents = getResponsibleXMLSecEvents(eventQueue, index);
         final List<QName> elementPath = getElementPath(eventQueue);
 
-        final TokenContext tokenContext = new TokenContext(wssSecurityProperties, wsSecurityContext, xmlSecEvents, elementPath);
+        final TokenContext tokenContext = new TokenContext(wssSecurityProperties, wsInboundSecurityContext, xmlSecEvents, elementPath);
 
         SecurityContextTokenValidator securityContextTokenValidator = wssSecurityProperties.getValidator(elementName);
         if (securityContextTokenValidator == null) {
             securityContextTokenValidator = new SecurityContextTokenValidatorImpl();
         }
-        final SecurityToken securityContextToken =
+        final InboundSecurityToken securityContextToken =
                 securityContextTokenValidator.validate(securityContextTokenType, identifier, tokenContext);
 
-        SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
+        SecurityTokenProvider<InboundSecurityToken> securityTokenProvider =
+                new SecurityTokenProvider<InboundSecurityToken>() {
 
-            @SuppressWarnings("unchecked")
             @Override
-            public SecurityToken getSecurityToken() throws XMLSecurityException {
+            public InboundSecurityToken getSecurityToken() throws XMLSecurityException {
                 return securityContextToken;
             }
 
@@ -85,14 +87,14 @@ public class SecurityContextTokenInputHa
                 return securityContextTokenType.getId();
             }
         };
-        wsSecurityContext.registerSecurityTokenProvider(securityContextTokenType.getId(), securityTokenProvider);
+        wsInboundSecurityContext.registerSecurityTokenProvider(securityContextTokenType.getId(), securityTokenProvider);
 
         //also register a SecurityProvider with the identifier. @see SecurityContexTest#testSCTKDKTSignAbsolute
-        SecurityTokenProvider securityTokenProviderDirectReference = new SecurityTokenProvider() {
+        SecurityTokenProvider<InboundSecurityToken> securityTokenProviderDirectReference =
+                new SecurityTokenProvider<InboundSecurityToken>() {
 
-            @SuppressWarnings("unchecked")
             @Override
-            public SecurityToken getSecurityToken() throws XMLSecurityException {
+            public InboundSecurityToken getSecurityToken() throws XMLSecurityException {
                 return securityContextToken;
             }
 
@@ -101,12 +103,12 @@ public class SecurityContextTokenInputHa
                 return identifier;
             }
         };
-        wsSecurityContext.registerSecurityTokenProvider(identifier, securityTokenProviderDirectReference);
+        wsInboundSecurityContext.registerSecurityTokenProvider(identifier, securityTokenProviderDirectReference);
 
         //fire a tokenSecurityEvent
         SecurityContextTokenSecurityEvent securityContextTokenSecurityEvent = new SecurityContextTokenSecurityEvent();
-        securityContextTokenSecurityEvent.setSecurityToken((SecurityToken) securityTokenProvider.getSecurityToken());
+        securityContextTokenSecurityEvent.setSecurityToken(securityTokenProvider.getSecurityToken());
         securityContextTokenSecurityEvent.setCorrelationID(securityContextTokenType.getId());
-        wsSecurityContext.registerSecurityEvent(securityContextTokenSecurityEvent);
+        wsInboundSecurityContext.registerSecurityEvent(securityContextTokenSecurityEvent);
     }
 }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityHeaderInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityHeaderInputProcessor.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityHeaderInputProcessor.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityHeaderInputProcessor.java Mon Apr  1 13:57:32 2013
@@ -27,10 +27,10 @@ import javax.xml.stream.XMLStreamExcepti
 
 import org.apache.wss4j.common.bsp.BSPRule;
 import org.apache.wss4j.common.ext.WSSecurityException;
+import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.wss4j.stax.ext.WSSUtils;
-import org.apache.wss4j.stax.ext.WSSecurityContext;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.config.SecurityHeaderHandlerMapper;
 import org.apache.xml.security.stax.ext.AbstractInputProcessor;
@@ -141,8 +141,8 @@ public class SecurityHeaderInputProcesso
                         // Check for multiple timestamps
                         if (xmlSecEndElement.getName().equals(WSSConstants.TAG_wsu_Timestamp)) {
                             if (timestampFound) {
-                                WSSecurityContext context = 
-                                    (WSSecurityContext)subInputProcessorChain.getSecurityContext();
+                                WSInboundSecurityContext context =
+                                    (WSInboundSecurityContext)subInputProcessorChain.getSecurityContext();
                                 context.handleBSPRule(BSPRule.R3227);
                             }
                             timestampFound = true;

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityTokenReferenceInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityTokenReferenceInputHandler.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityTokenReferenceInputHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityTokenReferenceInputHandler.java Mon Apr  1 13:57:32 2013
@@ -22,16 +22,19 @@ import org.apache.wss4j.binding.wss10.Ke
 import org.apache.wss4j.binding.wss10.ReferenceType;
 import org.apache.wss4j.binding.wss10.SecurityTokenReferenceType;
 import org.apache.wss4j.common.ext.WSSecurityException;
+import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.wss4j.stax.ext.WSSUtils;
-import org.apache.wss4j.stax.ext.WSSecurityContext;
-import org.apache.wss4j.stax.impl.securityToken.SecurityTokenReference;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
+import org.apache.wss4j.stax.impl.securityToken.SecurityTokenReferenceImpl;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.ext.*;
 import org.apache.xml.security.stax.ext.stax.XMLSecEndElement;
 import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
 import org.apache.xml.security.stax.ext.stax.XMLSecStartElement;
+import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityTokenProvider;
 
 import javax.xml.bind.JAXBElement;
 import javax.xml.namespace.QName;
@@ -141,26 +144,26 @@ public class SecurityTokenReferenceInput
                         end = true;
                         xmlSecEventList.push(xmlSecEvent);
 
-                        SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
+                        SecurityTokenProvider<InboundSecurityToken> securityTokenProvider =
+                                new SecurityTokenProvider<InboundSecurityToken>() {
 
-                            private SecurityToken securityToken = null;
+                            private InboundSecurityToken securityToken = null;
 
-                            @SuppressWarnings("unchecked")
                             @Override
-                            public SecurityToken getSecurityToken() throws XMLSecurityException {
+                            public InboundSecurityToken getSecurityToken() throws XMLSecurityException {
                                 if (this.securityToken != null) {
                                     return this.securityToken;
                                 }
 
-                                SecurityTokenProvider securityTokenProvider =
+                                SecurityTokenProvider<? extends InboundSecurityToken> securityTokenProvider =
                                         inputProcessorChain.getSecurityContext().getSecurityTokenProvider(attributeValue);
-                                SecurityToken securityToken = securityTokenProvider.getSecurityToken();
-                                return this.securityToken = new SecurityTokenReference(
+                                InboundSecurityToken securityToken = securityTokenProvider.getSecurityToken();
+                                return this.securityToken = new SecurityTokenReferenceImpl(
                                         securityToken,
                                         xmlSecEventList,
-                                        (WSSecurityContext) inputProcessorChain.getSecurityContext(),
+                                        (WSInboundSecurityContext) inputProcessorChain.getSecurityContext(),
                                         securityTokenReferenceId,
-                                        WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_REFERENCE);
+                                        WSSecurityTokenConstants.KeyIdentifier_SecurityTokenReference);
                             }
 
                             @Override

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SignatureConfirmationInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SignatureConfirmationInputHandler.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SignatureConfirmationInputHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SignatureConfirmationInputHandler.java Mon Apr  1 13:57:32 2013
@@ -21,7 +21,7 @@ package org.apache.wss4j.stax.impl.proce
 import org.apache.wss4j.binding.wss11.SignatureConfirmationType;
 import org.apache.wss4j.common.bsp.BSPRule;
 import org.apache.wss4j.common.ext.WSSecurityException;
-import org.apache.wss4j.stax.ext.WSSecurityContext;
+import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.ext.AbstractInputSecurityHeaderHandler;
 import org.apache.xml.security.stax.ext.InputProcessorChain;
@@ -51,7 +51,7 @@ public class SignatureConfirmationInputH
 
     private void checkBSPCompliance(InputProcessorChain inputProcessorChain, SignatureConfirmationType signatureConfirmationType) throws WSSecurityException {
         if (signatureConfirmationType.getId() == null) {
-            ((WSSecurityContext) inputProcessorChain.getSecurityContext()).handleBSPRule(BSPRule.R5441);
+            ((WSInboundSecurityContext) inputProcessorChain.getSecurityContext()).handleBSPRule(BSPRule.R5441);
         }
     }
 }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/TimestampInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/TimestampInputHandler.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/TimestampInputHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/TimestampInputHandler.java Mon Apr  1 13:57:32 2013
@@ -21,9 +21,9 @@ package org.apache.wss4j.stax.impl.proce
 import org.apache.wss4j.binding.wsu10.TimestampType;
 import org.apache.wss4j.common.bsp.BSPRule;
 import org.apache.wss4j.common.ext.WSSecurityException;
+import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
-import org.apache.wss4j.stax.ext.WSSecurityContext;
 import org.apache.wss4j.stax.securityEvent.TimestampSecurityEvent;
 import org.apache.wss4j.stax.validate.TimestampValidator;
 import org.apache.wss4j.stax.validate.TimestampValidatorImpl;
@@ -51,15 +51,15 @@ public class TimestampInputHandler exten
                        Deque<XMLSecEvent> eventQueue, Integer index) throws XMLSecurityException {
 
         final WSSSecurityProperties wssSecurityProperties = (WSSSecurityProperties) securityProperties;
-        final WSSecurityContext wssecurityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
+        final WSInboundSecurityContext wssecurityContextInbound = (WSInboundSecurityContext) inputProcessorChain.getSecurityContext();
 
         //Chapter 10 Security Timestamps: ...may only be present at most once per header (that is, per SOAP actor/role)
-        Boolean alreadyProcessed = wssecurityContext.<Boolean>get(WSSConstants.TIMESTAMP_PROCESSED);
+        Boolean alreadyProcessed = wssecurityContextInbound.<Boolean>get(WSSConstants.TIMESTAMP_PROCESSED);
         if (Boolean.TRUE.equals(alreadyProcessed)) {
             throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, "invalidTimestamp",
                     "Message contains two or more timestamps");
         }
-        wssecurityContext.put(WSSConstants.TIMESTAMP_PROCESSED, Boolean.TRUE);
+        wssecurityContextInbound.put(WSSConstants.TIMESTAMP_PROCESSED, Boolean.TRUE);
 
         @SuppressWarnings("unchecked")
         final TimestampType timestampType =
@@ -78,7 +78,7 @@ public class TimestampInputHandler exten
         if (timestampValidator == null) {
             timestampValidator = new TimestampValidatorImpl();
         }
-        TokenContext tokenContext = new TokenContext(wssSecurityProperties, wssecurityContext, xmlSecEvents, elementPath);
+        TokenContext tokenContext = new TokenContext(wssSecurityProperties, wssecurityContextInbound, xmlSecEvents, elementPath);
         timestampValidator.validate(timestampType, tokenContext);
 
         TimestampSecurityEvent timestampSecurityEvent = new TimestampSecurityEvent();
@@ -99,13 +99,13 @@ public class TimestampInputHandler exten
             }
         }
         timestampSecurityEvent.setCorrelationID(timestampType.getId());
-        wssecurityContext.registerSecurityEvent(timestampSecurityEvent);
-        wssecurityContext.put(WSSConstants.PROP_TIMESTAMP_SECURITYEVENT, timestampSecurityEvent);
+        wssecurityContextInbound.registerSecurityEvent(timestampSecurityEvent);
+        wssecurityContextInbound.put(WSSConstants.PROP_TIMESTAMP_SECURITYEVENT, timestampSecurityEvent);
     }
 
     private void checkBSPCompliance(InputProcessorChain inputProcessorChain, TimestampType timestampType,
                                     List<XMLSecEvent> xmlSecEvents) throws WSSecurityException {
-        final WSSecurityContext securityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
+        final WSInboundSecurityContext securityContext = (WSInboundSecurityContext) inputProcessorChain.getSecurityContext();
         if (timestampType.getCreated() == null) {
             securityContext.handleBSPRule(BSPRule.R3203);
         }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/UsernameTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/UsernameTokenInputHandler.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/UsernameTokenInputHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/UsernameTokenInputHandler.java Mon Apr  1 13:57:32 2013
@@ -28,9 +28,11 @@ import org.apache.wss4j.binding.wsu10.At
 import org.apache.wss4j.common.bsp.BSPRule;
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.common.util.DateUtil;
+import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
-import org.apache.wss4j.stax.ext.WSSecurityContext;
+import org.apache.wss4j.stax.securityToken.UsernameSecurityToken;
+import org.apache.wss4j.stax.impl.securityToken.UsernameSecurityTokenImpl;
 import org.apache.wss4j.stax.securityEvent.UsernameTokenSecurityEvent;
 import org.apache.wss4j.stax.validate.TokenContext;
 import org.apache.wss4j.stax.validate.UsernameTokenValidator;
@@ -39,6 +41,8 @@ import org.apache.xml.security.exception
 import org.apache.xml.security.stax.ext.*;
 import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
 import org.apache.xml.security.stax.impl.util.IDGenerator;
+import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityTokenProvider;
 
 import javax.xml.bind.JAXBElement;
 import javax.xml.datatype.XMLGregorianCalendar;
@@ -102,29 +106,36 @@ public class UsernameTokenInputHandler e
             }
         }
 
-        final WSSecurityContext wsSecurityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
+        final WSInboundSecurityContext wsInboundSecurityContext = (WSInboundSecurityContext) inputProcessorChain.getSecurityContext();
         final WSSSecurityProperties wssSecurityProperties = (WSSSecurityProperties) securityProperties;
         final List<QName> elementPath = getElementPath(eventQueue);
         
         // Verify Created
         verifyCreated(wssSecurityProperties, usernameTokenType);
         
-        final TokenContext tokenContext = new TokenContext(wssSecurityProperties, wsSecurityContext, xmlSecEvents, elementPath);
+        final TokenContext tokenContext = new TokenContext(wssSecurityProperties, wsInboundSecurityContext, xmlSecEvents, elementPath);
 
         UsernameTokenValidator usernameTokenValidator =
                 wssSecurityProperties.getValidator(WSSConstants.TAG_wsse_UsernameToken);
         if (usernameTokenValidator == null) {
             usernameTokenValidator = new UsernameTokenValidatorImpl();
         }
-        final SecurityToken usernameSecurityToken =
-                usernameTokenValidator.validate(usernameTokenType, tokenContext);
+        //jdk 1.6 compiler bug? http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302954
+        //type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with
+        // upper bounds org.apache.wss4j.stax.securityToken.UsernameSecurityToken,
+        // org.apache.wss4j.stax.securityToken.UsernameSecurityToken,
+        // org.apache.xml.security.stax.ext.securityToken.InboundSecurityToken
+        //works fine on jdk 1.7
+        final UsernameSecurityToken usernameSecurityToken =
+                usernameTokenValidator.</*fake @see above*/UsernameSecurityTokenImpl>
+                        validate(usernameTokenType, tokenContext);
 
-        SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
+        SecurityTokenProvider<InboundSecurityToken> securityTokenProvider =
+                new SecurityTokenProvider<InboundSecurityToken>() {
 
-            @SuppressWarnings("unchecked")
             @Override
-            public SecurityToken getSecurityToken() throws XMLSecurityException {
-                return usernameSecurityToken;
+            public InboundSecurityToken getSecurityToken() throws XMLSecurityException {
+                return (InboundSecurityToken)usernameSecurityToken;
             }
 
             @Override
@@ -134,16 +145,9 @@ public class UsernameTokenInputHandler e
         };
         inputProcessorChain.getSecurityContext().registerSecurityTokenProvider(usernameTokenType.getId(), securityTokenProvider);
 
-        PasswordString passwordType = XMLSecurityUtils.getQNameType(usernameTokenType.getAny(), WSSConstants.TAG_wsse_Password);
-        WSSConstants.UsernameTokenPasswordType usernameTokenPasswordType = WSSConstants.UsernameTokenPasswordType.PASSWORD_NONE;
-        if (passwordType != null && passwordType.getType() != null) {
-            usernameTokenPasswordType = WSSConstants.UsernameTokenPasswordType.getUsernameTokenPasswordType(passwordType.getType());
-        }
-
         //fire a tokenSecurityEvent
         UsernameTokenSecurityEvent usernameTokenSecurityEvent = new UsernameTokenSecurityEvent();
-        usernameTokenSecurityEvent.setUsernameTokenPasswordType(usernameTokenPasswordType);
-        usernameTokenSecurityEvent.setSecurityToken((SecurityToken) securityTokenProvider.getSecurityToken());
+        usernameTokenSecurityEvent.setSecurityToken((UsernameSecurityToken)securityTokenProvider.getSecurityToken());
         usernameTokenSecurityEvent.setUsernameTokenProfile(WSSConstants.NS_USERNAMETOKEN_PROFILE11);
         usernameTokenSecurityEvent.setCorrelationID(usernameTokenType.getId());
         inputProcessorChain.getSecurityContext().registerSecurityEvent(usernameTokenSecurityEvent);
@@ -152,7 +156,7 @@ public class UsernameTokenInputHandler e
     private void checkBSPCompliance(InputProcessorChain inputProcessorChain, UsernameTokenType usernameTokenType,
                                     List<XMLSecEvent> xmlSecEvents) throws WSSecurityException {
 
-        final WSSecurityContext securityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
+        final WSInboundSecurityContext securityContext = (WSInboundSecurityContext) inputProcessorChain.getSecurityContext();
         if (usernameTokenType.getAny() == null) {
             securityContext.handleBSPRule(BSPRule.R3031);
         }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSEncryptedKeyInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSEncryptedKeyInputHandler.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSEncryptedKeyInputHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSEncryptedKeyInputHandler.java Mon Apr  1 13:57:32 2013
@@ -22,6 +22,7 @@ import org.apache.wss4j.binding.wss10.Ob
 import org.apache.wss4j.binding.wss10.ReferenceType;
 import org.apache.wss4j.binding.wss10.SecurityTokenReferenceType;
 import org.apache.wss4j.common.bsp.BSPRule;
+import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
 import org.apache.xml.security.binding.xmldsig.KeyInfoType;
 import org.apache.xml.security.binding.xmlenc.EncryptedKeyType;
 import org.apache.xml.security.binding.xmlenc.EncryptionMethodType;
@@ -32,7 +33,6 @@ import org.apache.xml.security.stax.ext.
 import org.apache.xml.security.stax.impl.processor.input.XMLEncryptedKeyInputHandler;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
-import org.apache.wss4j.stax.ext.WSSecurityContext;
 
 /**
  * Processor for the EncryptedKey XML Structure
@@ -61,13 +61,13 @@ public class WSSEncryptedKeyInputHandler
         inputProcessorChain.addProcessor(
                 new DecryptInputProcessor(keyInfoType, encryptedKeyType.getReferenceList(),
                         (WSSSecurityProperties) securityProperties, 
-                        (WSSecurityContext) inputProcessorChain.getSecurityContext())
+                        (WSInboundSecurityContext) inputProcessorChain.getSecurityContext())
                 );
     }
 
     protected void checkBSPCompliance(InputProcessorChain inputProcessorChain, EncryptedKeyType encryptedKeyType)
             throws XMLSecurityException {
-        final WSSecurityContext securityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
+        final WSInboundSecurityContext securityContext = (WSInboundSecurityContext) inputProcessorChain.getSecurityContext();
         if (encryptedKeyType.getType() != null) {
             securityContext.handleBSPRule(BSPRule.R3209);
         }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureInputHandler.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureInputHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureInputHandler.java Mon Apr  1 13:57:32 2013
@@ -21,10 +21,11 @@ package org.apache.wss4j.stax.impl.proce
 import org.apache.wss4j.binding.wss10.SecurityTokenReferenceType;
 import org.apache.wss4j.common.bsp.BSPRule;
 import org.apache.wss4j.common.ext.WSSecurityException;
+import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.wss4j.stax.ext.WSSUtils;
-import org.apache.wss4j.stax.ext.WSSecurityContext;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.wss4j.stax.validate.SignatureTokenValidator;
 import org.apache.wss4j.stax.validate.SignatureTokenValidatorImpl;
 import org.apache.xml.security.binding.excc14n.InclusiveNamespaces;
@@ -35,10 +36,11 @@ import org.apache.xml.security.binding.x
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.ext.*;
 import org.apache.xml.security.stax.impl.processor.input.AbstractSignatureInputHandler;
-import org.apache.xml.security.stax.impl.securityToken.SecurityTokenFactory;
 import org.apache.xml.security.stax.securityEvent.AlgorithmSuiteSecurityEvent;
 import org.apache.xml.security.stax.securityEvent.SignatureValueSecurityEvent;
 import org.apache.xml.security.stax.securityEvent.TokenSecurityEvent;
+import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityTokenFactory;
 
 import java.math.BigInteger;
 import java.util.Iterator;
@@ -56,7 +58,7 @@ public class WSSSignatureInputHandler ex
         }
         checkBSPCompliance(inputProcessorChain, signatureType);
 
-        final WSSecurityContext securityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
+        final WSInboundSecurityContext securityContext = (WSInboundSecurityContext) inputProcessorChain.getSecurityContext();
 
         SignatureValueSecurityEvent signatureValueSecurityEvent = new SignatureValueSecurityEvent();
         signatureValueSecurityEvent.setSignatureValue(signatureType.getSignatureValue().getValue());
@@ -65,7 +67,7 @@ public class WSSSignatureInputHandler ex
 
         AlgorithmSuiteSecurityEvent algorithmSuiteSecurityEvent = new AlgorithmSuiteSecurityEvent();
         algorithmSuiteSecurityEvent.setAlgorithmURI(signatureType.getSignedInfo().getCanonicalizationMethod().getAlgorithm());
-        algorithmSuiteSecurityEvent.setKeyUsage(WSSConstants.C14n);
+        algorithmSuiteSecurityEvent.setAlgorithmUsage(WSSConstants.C14n);
         algorithmSuiteSecurityEvent.setCorrelationID(signatureType.getId());
         securityContext.registerSecurityEvent(algorithmSuiteSecurityEvent);
 
@@ -74,7 +76,7 @@ public class WSSSignatureInputHandler ex
 
     private void checkBSPCompliance(InputProcessorChain inputProcessorChain, SignatureType signatureType) throws WSSecurityException {
         String algorithm = signatureType.getSignedInfo().getSignatureMethod().getAlgorithm();
-        final WSSecurityContext securityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
+        final WSInboundSecurityContext securityContext = (WSInboundSecurityContext) inputProcessorChain.getSecurityContext();
         if (!WSSConstants.NS_XMLDSIG_HMACSHA1.equals(algorithm) && !WSSConstants.NS_XMLDSIG_RSASHA1.equals(algorithm)) {
             securityContext.handleBSPRule(BSPRule.R5421);
         }
@@ -121,43 +123,43 @@ public class WSSSignatureInputHandler ex
     @Override
     protected void addSignatureReferenceInputProcessorToChain(
             InputProcessorChain inputProcessorChain, XMLSecurityProperties securityProperties,
-            SignatureType signatureType, SecurityToken securityToken) throws XMLSecurityException {
+            SignatureType signatureType, InboundSecurityToken inboundSecurityToken) throws XMLSecurityException {
 
         //add processors to verify references
         inputProcessorChain.addProcessor(
                 new WSSSignatureReferenceVerifyInputProcessor(inputProcessorChain, signatureType,
-                        securityToken, securityProperties));
+                        inboundSecurityToken, securityProperties));
     }
 
     public class WSSSignatureVerifier extends SignatureVerifier {
 
-        public WSSSignatureVerifier(SignatureType signatureType, SecurityContext securityContext,
+        public WSSSignatureVerifier(SignatureType signatureType, InboundSecurityContext inboundSecurityContext,
                                     XMLSecurityProperties securityProperties) throws XMLSecurityException {
-            super(signatureType, securityContext, securityProperties);
+            super(signatureType, inboundSecurityContext, securityProperties);
         }
 
         @Override
-        protected SecurityToken retrieveSecurityToken(SignatureType signatureType,
+        protected InboundSecurityToken retrieveSecurityToken(SignatureType signatureType,
                                                       XMLSecurityProperties securityProperties,
-                                                      SecurityContext securityContext) throws XMLSecurityException {
+                                                      InboundSecurityContext inboundSecurityContext) throws XMLSecurityException {
 
-            SecurityToken securityToken = SecurityTokenFactory.getInstance().getSecurityToken(
-                    signatureType.getKeyInfo(), SecurityToken.KeyInfoUsage.SIGNATURE_VERIFICATION,
-                    securityProperties, securityContext);
+            InboundSecurityToken inboundSecurityToken = SecurityTokenFactory.getInstance().getSecurityToken(
+                    signatureType.getKeyInfo(), WSSecurityTokenConstants.KeyUsage_Signature_Verification,
+                    securityProperties, inboundSecurityContext);
 
             SignatureTokenValidator signatureTokenValidator = ((WSSSecurityProperties) securityProperties).getValidator(WSSConstants.TAG_dsig_Signature);
             if (signatureTokenValidator == null) {
                 signatureTokenValidator = new SignatureTokenValidatorImpl();
             }
-            signatureTokenValidator.validate(securityToken, (WSSSecurityProperties) securityProperties);
+            signatureTokenValidator.validate(inboundSecurityToken, (WSSSecurityProperties) securityProperties);
 
             //todo element path?
             //we have to emit a TokenSecurityEvent here too since it could be an embedded token
-            securityToken.addTokenUsage(SecurityToken.TokenUsage.Signature);
-            TokenSecurityEvent tokenSecurityEvent = WSSUtils.createTokenSecurityEvent(securityToken, signatureType.getId());
-            securityContext.registerSecurityEvent(tokenSecurityEvent);
+            inboundSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_Signature);
+            TokenSecurityEvent tokenSecurityEvent = WSSUtils.createTokenSecurityEvent(inboundSecurityToken, signatureType.getId());
+            inboundSecurityContext.registerSecurityEvent(tokenSecurityEvent);
 
-            return securityToken;
+            return inboundSecurityToken;
         }
     }
 }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureReferenceVerifyInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureReferenceVerifyInputProcessor.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureReferenceVerifyInputProcessor.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureReferenceVerifyInputProcessor.java Mon Apr  1 13:57:32 2013
@@ -24,6 +24,7 @@ import org.apache.jcs.engine.ElementAttr
 import org.apache.wss4j.binding.wss10.TransformationParametersType;
 import org.apache.wss4j.common.bsp.BSPRule;
 import org.apache.wss4j.common.ext.WSSecurityException;
+import org.apache.wss4j.stax.securityToken.SecurityTokenReference;
 import org.apache.xml.security.binding.excc14n.InclusiveNamespaces;
 import org.apache.xml.security.binding.xmldsig.CanonicalizationMethodType;
 import org.apache.xml.security.binding.xmldsig.ReferenceType;
@@ -37,9 +38,11 @@ import org.apache.xml.security.stax.impl
 import org.apache.xml.security.stax.securityEvent.AlgorithmSuiteSecurityEvent;
 import org.apache.xml.security.stax.securityEvent.SignedElementSecurityEvent;
 import org.apache.wss4j.stax.ext.*;
-import org.apache.wss4j.stax.impl.securityToken.SecurityTokenReference;
 import org.apache.wss4j.stax.securityEvent.SignedPartSecurityEvent;
 import org.apache.wss4j.stax.securityEvent.TimestampSecurityEvent;
+import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityTokenProvider;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -64,15 +67,15 @@ public class WSSSignatureReferenceVerify
     private boolean replayChecked = false;
 
     public WSSSignatureReferenceVerifyInputProcessor(InputProcessorChain inputProcessorChain,
-            SignatureType signatureType, SecurityToken securityToken,
+            SignatureType signatureType, InboundSecurityToken inboundSecurityToken,
             XMLSecurityProperties securityProperties) throws XMLSecurityException {
-        super(inputProcessorChain, signatureType, securityToken, securityProperties);
+        super(inputProcessorChain, signatureType, inboundSecurityToken, securityProperties);
         this.addAfterProcessor(WSSSignatureReferenceVerifyInputProcessor.class.getName());
 
-        checkBSPCompliance((WSSecurityContext)inputProcessorChain.getSecurityContext());
+        checkBSPCompliance((WSInboundSecurityContext)inputProcessorChain.getSecurityContext());
     }
 
-    private void checkBSPCompliance(WSSecurityContext securityContext) throws WSSecurityException {
+    private void checkBSPCompliance(WSInboundSecurityContext securityContext) throws WSSecurityException {
         List<ReferenceType> references = getSignatureType().getSignedInfo().getReference();
         for (int i = 0; i < references.size(); i++) {
             ReferenceType referenceType = references.get(i);
@@ -150,14 +153,14 @@ public class WSSSignatureReferenceVerify
         final DocumentContext documentContext = inputProcessorChain.getDocumentContext();
         if (elementPath.size() == 3 && WSSUtils.isInSOAPHeader(elementPath)) {
             SignedPartSecurityEvent signedPartSecurityEvent =
-                    new SignedPartSecurityEvent(getSecurityToken(), true, documentContext.getProtectionOrder());
+                    new SignedPartSecurityEvent(getInboundSecurityToken(), true, documentContext.getProtectionOrder());
             signedPartSecurityEvent.setElementPath(elementPath);
             signedPartSecurityEvent.setXmlSecEvent(xmlSecEvent);
             signedPartSecurityEvent.setCorrelationID(referenceType.getId());
             inputProcessorChain.getSecurityContext().registerSecurityEvent(signedPartSecurityEvent);
         } else {
             SignedElementSecurityEvent signedElementSecurityEvent =
-                    new SignedElementSecurityEvent(getSecurityToken(), true, documentContext.getProtectionOrder());
+                    new SignedElementSecurityEvent(getInboundSecurityToken(), true, documentContext.getProtectionOrder());
             signedElementSecurityEvent.setElementPath(elementPath);
             signedElementSecurityEvent.setXmlSecEvent(xmlSecEvent);
             signedElementSecurityEvent.setCorrelationID(referenceType.getId());
@@ -238,7 +241,7 @@ public class WSSSignatureReferenceVerify
             algorithm = transformType.getAlgorithm();
             AlgorithmSuiteSecurityEvent algorithmSuiteSecurityEvent = new AlgorithmSuiteSecurityEvent();
             algorithmSuiteSecurityEvent.setAlgorithmURI(algorithm);
-            algorithmSuiteSecurityEvent.setKeyUsage(WSSConstants.C14n);
+            algorithmSuiteSecurityEvent.setAlgorithmUsage(WSSConstants.C14n);
             algorithmSuiteSecurityEvent.setCorrelationID(referenceType.getId());
             inputProcessorChain.getSecurityContext().registerSecurityEvent(algorithmSuiteSecurityEvent);
 
@@ -256,7 +259,8 @@ public class WSSSignatureReferenceVerify
 
             internalSignatureReferenceVerifier.setTransformer(parentTransformer);
 
-            SecurityTokenProvider securityTokenProvider = inputProcessorChain.getSecurityContext().getSecurityTokenProvider(XMLSecurityUtils.dropReferenceMarker(referenceType.getURI()));
+            SecurityTokenProvider<? extends InboundSecurityToken> securityTokenProvider =
+                    inputProcessorChain.getSecurityContext().getSecurityTokenProvider(XMLSecurityUtils.dropReferenceMarker(referenceType.getURI()));
             if (securityTokenProvider == null) {
                 throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN, "noReference");
             }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/BinarySecurityTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/BinarySecurityTokenOutputProcessor.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/BinarySecurityTokenOutputProcessor.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/BinarySecurityTokenOutputProcessor.java Mon Apr  1 13:57:32 2013
@@ -25,15 +25,17 @@ import org.apache.wss4j.common.ext.WSSec
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.wss4j.stax.ext.WSSUtils;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.ext.*;
 import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
 import org.apache.xml.security.stax.ext.stax.XMLSecStartElement;
 import org.apache.xml.security.stax.impl.securityToken.GenericOutboundSecurityToken;
-import org.apache.xml.security.stax.impl.securityToken.OutboundSecurityToken;
 import org.apache.xml.security.stax.impl.util.IDGenerator;
 import org.apache.xml.security.stax.securityEvent.SecurityEvent;
 import org.apache.xml.security.stax.securityEvent.TokenSecurityEvent;
+import org.apache.xml.security.stax.securityToken.OutboundSecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityTokenProvider;
 
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
@@ -55,9 +57,9 @@ public class BinarySecurityTokenOutputPr
             final Key key;
 
             XMLSecurityConstants.Action action = getAction();
-            if (action.equals(WSSConstants.SIGNATURE)
-                    || action.equals(WSSConstants.SAML_TOKEN_SIGNED)
-                    || action.equals(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)) {
+            if (WSSConstants.SIGNATURE.equals(action)
+                    || WSSConstants.SAML_TOKEN_SIGNED.equals(action)
+                    || WSSConstants.SIGNATURE_WITH_DERIVED_KEY.equals(action)) {
 
                 String alias = ((WSSSecurityProperties) getSecurityProperties()).getSignatureUser();
                 WSPasswordCallback pwCb = new WSPasswordCallback(alias, WSPasswordCallback.Usage.SIGNATURE);
@@ -73,8 +75,8 @@ public class BinarySecurityTokenOutputPr
                 if (x509Certificates == null || x509Certificates.length == 0) {
                     throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_SIGNATURE, "noUserCertsFound", alias);
                 }
-            } else if (action.equals(WSSConstants.ENCRYPT) ||
-                    action.equals(WSSConstants.ENCRYPT_WITH_DERIVED_KEY)) {
+            } else if (WSSConstants.ENCRYPT.equals(action) ||
+                    WSSConstants.ENCRYPT_WITH_DERIVED_KEY.equals(action)) {
                 X509Certificate x509Certificate = getReqSigCert(outputProcessorChain.getSecurityContext());
                 if (((WSSSecurityProperties) getSecurityProperties()).isUseReqSigCertForEncryption()) {
                     if (x509Certificate == null) {
@@ -117,10 +119,10 @@ public class BinarySecurityTokenOutputPr
             }
 
             final GenericOutboundSecurityToken binarySecurityToken =
-                    new GenericOutboundSecurityToken(bstId, WSSConstants.X509V3Token, key, x509Certificates);
-            final SecurityTokenProvider binarySecurityTokenProvider = new SecurityTokenProvider() {
+                    new GenericOutboundSecurityToken(bstId, WSSecurityTokenConstants.X509V3Token, key, x509Certificates);
+            final SecurityTokenProvider<OutboundSecurityToken> binarySecurityTokenProvider =
+                    new SecurityTokenProvider<OutboundSecurityToken>() {
 
-                @SuppressWarnings("unchecked")
                 @Override
                 public OutboundSecurityToken getSecurityToken() throws WSSecurityException {
                     return binarySecurityToken;
@@ -132,10 +134,10 @@ public class BinarySecurityTokenOutputPr
                 }
             };
 
-            if (action.equals(WSSConstants.SIGNATURE)
-                    || action.equals(WSSConstants.SAML_TOKEN_SIGNED)) {
+            if (WSSConstants.SIGNATURE.equals(action)
+                    || WSSConstants.SAML_TOKEN_SIGNED.equals(action)) {
                 outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_SIGNATURE, bstId);
-                if (getSecurityProperties().getSignatureKeyIdentifierType() == WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE) {
+                if (WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference.equals(getSecurityProperties().getSignatureKeyIdentifier())) {
                     outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_APPEND_SIGNATURE_ON_THIS_ID, bstId);
                     FinalBinarySecurityTokenOutputProcessor finalBinarySecurityTokenOutputProcessor = new FinalBinarySecurityTokenOutputProcessor(binarySecurityToken);
                     finalBinarySecurityTokenOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
@@ -144,9 +146,9 @@ public class BinarySecurityTokenOutputPr
                     finalBinarySecurityTokenOutputProcessor.init(outputProcessorChain);
                     binarySecurityToken.setProcessor(finalBinarySecurityTokenOutputProcessor);
                 }
-            } else if (action.equals(WSSConstants.ENCRYPT)) {
+            } else if (WSSConstants.ENCRYPT.equals(action)) {
                 outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_ENCRYPTED_KEY, bstId);
-                if (((WSSSecurityProperties) getSecurityProperties()).getEncryptionKeyIdentifierType() == WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE) {
+                if (WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference.equals(((WSSSecurityProperties) getSecurityProperties()).getEncryptionKeyIdentifier())) {
                     FinalBinarySecurityTokenOutputProcessor finalBinarySecurityTokenOutputProcessor = new FinalBinarySecurityTokenOutputProcessor(binarySecurityToken);
                     finalBinarySecurityTokenOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
                     finalBinarySecurityTokenOutputProcessor.setAction(getAction());
@@ -154,8 +156,8 @@ public class BinarySecurityTokenOutputPr
                     finalBinarySecurityTokenOutputProcessor.init(outputProcessorChain);
                     binarySecurityToken.setProcessor(finalBinarySecurityTokenOutputProcessor);
                 }
-            } else if (action.equals(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)
-                    || action.equals(WSSConstants.ENCRYPT_WITH_DERIVED_KEY)) {
+            } else if (WSSConstants.SIGNATURE_WITH_DERIVED_KEY.equals(action)
+                    || WSSConstants.ENCRYPT_WITH_DERIVED_KEY.equals(action)) {
 
                 WSSConstants.DerivedKeyTokenReference derivedKeyTokenReference = ((WSSSecurityProperties) getSecurityProperties()).getDerivedKeyTokenReference();
                 switch (derivedKeyTokenReference) {
@@ -187,7 +189,7 @@ public class BinarySecurityTokenOutputPr
                 SecurityEvent securityEvent = securityEventList.get(i);
                 if (securityEvent instanceof TokenSecurityEvent) {
                     TokenSecurityEvent tokenSecurityEvent = (TokenSecurityEvent) securityEvent;
-                    if (!tokenSecurityEvent.getSecurityToken().getTokenUsages().contains(SecurityToken.TokenUsage.MainSignature)) {
+                    if (!tokenSecurityEvent.getSecurityToken().getTokenUsages().contains(WSSecurityTokenConstants.TokenUsage_MainSignature)) {
                         continue;
                     }
                     X509Certificate[] x509Certificates = tokenSecurityEvent.getSecurityToken().getX509Certificates();

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/DerivedKeyTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/DerivedKeyTokenOutputProcessor.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/DerivedKeyTokenOutputProcessor.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/DerivedKeyTokenOutputProcessor.java Mon Apr  1 13:57:32 2013
@@ -27,6 +27,7 @@ import org.apache.wss4j.common.ext.WSSec
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.wss4j.stax.ext.WSSUtils;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.config.JCEAlgorithmMapper;
 import org.apache.xml.security.stax.ext.*;
@@ -34,8 +35,9 @@ import org.apache.xml.security.stax.ext.
 import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
 import org.apache.xml.security.stax.ext.stax.XMLSecStartElement;
 import org.apache.xml.security.stax.impl.securityToken.GenericOutboundSecurityToken;
-import org.apache.xml.security.stax.impl.securityToken.OutboundSecurityToken;
 import org.apache.xml.security.stax.impl.util.IDGenerator;
+import org.apache.xml.security.stax.securityToken.OutboundSecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityTokenProvider;
 
 import javax.crypto.spec.SecretKeySpec;
 import javax.xml.stream.XMLStreamConstants;
@@ -60,7 +62,7 @@ public class DerivedKeyTokenOutputProces
             if (tokenId == null) {
                 throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE);
             }
-            SecurityTokenProvider wrappingSecurityTokenProvider = outputProcessorChain.getSecurityContext().getSecurityTokenProvider(tokenId);
+            SecurityTokenProvider<OutboundSecurityToken> wrappingSecurityTokenProvider = outputProcessorChain.getSecurityContext().getSecurityTokenProvider(tokenId);
             if (wrappingSecurityTokenProvider == null) {
                 throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE);
             }
@@ -75,9 +77,9 @@ public class DerivedKeyTokenOutputProces
             int length = 0;
 
             XMLSecurityConstants.Action action = getAction();
-            if (action.equals(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)) {
+            if (WSSConstants.SIGNATURE_WITH_DERIVED_KEY.equals(action)) {
                 length = JCEAlgorithmMapper.getAlgorithmMapping(getSecurityProperties().getSignatureAlgorithm()).getKeyLength() / 8;
-            } else if (action.equals(WSSConstants.ENCRYPT_WITH_DERIVED_KEY)) {
+            } else if (WSSConstants.ENCRYPT_WITH_DERIVED_KEY.equals(action)) {
                 length = JCEAlgorithmMapper.getAlgorithmMapping(getSecurityProperties().getEncryptionSymAlgorithm()).getKeyLength() / 8;
             }
 
@@ -105,7 +107,7 @@ public class DerivedKeyTokenOutputProces
             final byte[] derivedKeyBytes;
             try {
                 byte[] secret;
-                if (wrappingSecurityToken.getTokenType() == WSSConstants.SecurityContextToken) {
+                if (WSSecurityTokenConstants.SecurityContextToken.equals(wrappingSecurityToken.getTokenType())) {
                     WSPasswordCallback passwordCallback = new WSPasswordCallback(wsuIdDKT, WSPasswordCallback.Usage.SECRET_KEY);
                     WSSUtils.doSecretKeyCallback(((WSSSecurityProperties)securityProperties).getCallbackHandler(), passwordCallback, wsuIdDKT);
                     if (passwordCallback.getKey() == null) {
@@ -121,7 +123,8 @@ public class DerivedKeyTokenOutputProces
                 throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
             }
 
-            final GenericOutboundSecurityToken derivedKeySecurityToken = new GenericOutboundSecurityToken(wsuIdDKT, WSSConstants.DerivedKeyToken) {
+            final GenericOutboundSecurityToken derivedKeySecurityToken =
+                    new GenericOutboundSecurityToken(wsuIdDKT, WSSecurityTokenConstants.DerivedKeyToken) {
 
                 @Override
                 public Key getSecretKey(String algorithmURI) throws WSSecurityException {
@@ -145,9 +148,9 @@ public class DerivedKeyTokenOutputProces
             derivedKeySecurityToken.setKeyWrappingToken(wrappingSecurityToken);
             wrappingSecurityToken.addWrappedToken(derivedKeySecurityToken);
 
-            SecurityTokenProvider derivedKeysecurityTokenProvider = new SecurityTokenProvider() {
+            SecurityTokenProvider<OutboundSecurityToken> derivedKeysecurityTokenProvider =
+                    new SecurityTokenProvider<OutboundSecurityToken>() {
 
-                @SuppressWarnings("unchecked")
                 @Override
                 public OutboundSecurityToken getSecurityToken() throws WSSecurityException {
                     return derivedKeySecurityToken;
@@ -159,10 +162,10 @@ public class DerivedKeyTokenOutputProces
                 }
             };
 
-            if (action.equals(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)) {
+            if (WSSConstants.SIGNATURE_WITH_DERIVED_KEY.equals(action)) {
                 outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_SIGNATURE, wsuIdDKT);
                 outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_APPEND_SIGNATURE_ON_THIS_ID, wsuIdDKT);
-            } else if (action.equals(WSSConstants.ENCRYPT_WITH_DERIVED_KEY)) {
+            } else if (WSSConstants.ENCRYPT_WITH_DERIVED_KEY.equals(action)) {
                 outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_ENCRYPTION, wsuIdDKT);
             }
             outputProcessorChain.getSecurityContext().registerSecurityTokenProvider(wsuIdDKT, derivedKeysecurityTokenProvider);
@@ -209,7 +212,7 @@ public class DerivedKeyTokenOutputProces
                     createStartElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_wsc0502_DerivedKeyToken, true, attributes);
 
                     createSecurityTokenReferenceStructureForDerivedKey(subOutputProcessorChain, securityToken,
-                            ((WSSSecurityProperties) getSecurityProperties()).getDerivedKeyKeyIdentifierType(),
+                            ((WSSSecurityProperties) getSecurityProperties()).getDerivedKeyKeyIdentifier(),
                             ((WSSSecurityProperties) getSecurityProperties()).getDerivedKeyTokenReference(), getSecurityProperties().isUseSingleCert());
                     createStartElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_wsc0502_Offset, false, null);
                     createCharactersAndOutputAsEvent(subOutputProcessorChain, "" + offset);
@@ -230,14 +233,14 @@ public class DerivedKeyTokenOutputProces
         protected void createSecurityTokenReferenceStructureForDerivedKey(
                 OutputProcessorChain outputProcessorChain,
                 OutboundSecurityToken securityToken,
-                WSSConstants.KeyIdentifierType keyIdentifierType,
+                WSSecurityTokenConstants.KeyIdentifier keyIdentifier,
                 WSSConstants.DerivedKeyTokenReference derivedKeyTokenReference,
                 boolean useSingleCertificate)
                 throws XMLStreamException, XMLSecurityException {
 
             List<XMLSecAttribute> attributes = new ArrayList<XMLSecAttribute>(2);
             attributes.add(createAttribute(WSSConstants.ATT_wsu_Id, IDGenerator.generateID(null)));
-            if (keyIdentifierType == WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE && !useSingleCertificate) {
+            if (WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference.equals(keyIdentifier) && !useSingleCertificate) {
                 attributes.add(createAttribute(WSSConstants.ATT_wsse11_TokenType, WSSConstants.NS_X509PKIPathv1));
             } else if (derivedKeyTokenReference == WSSConstants.DerivedKeyTokenReference.EncryptedKey) {
                 attributes.add(createAttribute(WSSConstants.ATT_wsse11_TokenType, WSSConstants.NS_WSS_ENC_KEY_VALUE_TYPE));
@@ -247,15 +250,15 @@ public class DerivedKeyTokenOutputProces
             X509Certificate[] x509Certificates = securityToken.getKeyWrappingToken().getX509Certificates();
             String tokenId = securityToken.getKeyWrappingToken().getId();
 
-            if (keyIdentifierType == WSSConstants.WSSKeyIdentifierType.ISSUER_SERIAL) {
-                createX509IssuerSerialStructure(outputProcessorChain, x509Certificates);
-            } else if (keyIdentifierType == WSSConstants.WSSKeyIdentifierType.SKI_KEY_IDENTIFIER) {
+            if (WSSecurityTokenConstants.KeyIdentifier_IssuerSerial.equals(keyIdentifier)) {
+                WSSUtils.createX509IssuerSerialStructure(this, outputProcessorChain, x509Certificates);
+            } else if (WSSecurityTokenConstants.KeyIdentifier_SkiKeyIdentifier.equals(keyIdentifier)) {
                 WSSUtils.createX509SubjectKeyIdentifierStructure(this, outputProcessorChain, x509Certificates);
-            } else if (keyIdentifierType == WSSConstants.WSSKeyIdentifierType.X509_KEY_IDENTIFIER) {
+            } else if (WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier.equals(keyIdentifier)) {
                 WSSUtils.createX509KeyIdentifierStructure(this, outputProcessorChain, x509Certificates);
-            } else if (keyIdentifierType == WSSConstants.WSSKeyIdentifierType.THUMBPRINT_IDENTIFIER) {
+            } else if (WSSecurityTokenConstants.KeyIdentifier_ThumbprintIdentifier.equals(keyIdentifier)) {
                 WSSUtils.createThumbprintKeyIdentifierStructure(this, outputProcessorChain, x509Certificates);
-            } else if (keyIdentifierType == WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE) {
+            } else if (WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference.equals(keyIdentifier)) {
                 String valueType;
                 if (useSingleCertificate) {
                     valueType = WSSConstants.NS_X509_V3_TYPE;

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptEndingOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptEndingOutputProcessor.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptEndingOutputProcessor.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptEndingOutputProcessor.java Mon Apr  1 13:57:32 2013
@@ -57,7 +57,7 @@ public class EncryptEndingOutputProcesso
     @Override
     public void processHeaderEvent(OutputProcessorChain outputProcessorChain) throws XMLStreamException, XMLSecurityException {
         OutputProcessorChain subOutputProcessorChain = outputProcessorChain.createSubChain(this);
-        if (getAction() == WSSConstants.ENCRYPT_WITH_DERIVED_KEY) {
+        if (WSSConstants.ENCRYPT_WITH_DERIVED_KEY.equals(getAction())) {
             WSSUtils.createReferenceListStructureForEncryption(this, subOutputProcessorChain);
         }
     }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java Mon Apr  1 13:57:32 2013
@@ -37,15 +37,15 @@ import org.apache.xml.security.exception
 import org.apache.xml.security.stax.config.TransformerAlgorithmMapper;
 import org.apache.xml.security.stax.ext.OutputProcessorChain;
 import org.apache.xml.security.stax.ext.SecurePart;
-import org.apache.xml.security.stax.ext.SecurityTokenProvider;
 import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.apache.xml.security.stax.ext.stax.XMLSecAttribute;
 import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
 import org.apache.xml.security.stax.ext.stax.XMLSecStartElement;
 import org.apache.xml.security.stax.impl.EncryptionPartDef;
 import org.apache.xml.security.stax.impl.processor.output.AbstractEncryptOutputProcessor;
-import org.apache.xml.security.stax.impl.securityToken.OutboundSecurityToken;
 import org.apache.xml.security.stax.impl.util.IDGenerator;
+import org.apache.xml.security.stax.securityToken.OutboundSecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityTokenProvider;
 
 /**
  * Processor to encrypt XML structures
@@ -80,7 +80,7 @@ public class EncryptOutputProcessor exte
                     logger.debug("Matched encryptionPart for encryption");
                     InternalEncryptionOutputProcessor internalEncryptionOutputProcessor;
                     String tokenId = outputProcessorChain.getSecurityContext().get(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_ENCRYPTION);
-                    SecurityTokenProvider securityTokenProvider = outputProcessorChain.getSecurityContext().getSecurityTokenProvider(tokenId);
+                    SecurityTokenProvider<OutboundSecurityToken> securityTokenProvider = outputProcessorChain.getSecurityContext().getSecurityTokenProvider(tokenId);
                     OutboundSecurityToken securityToken = securityTokenProvider.getSecurityToken();
                     EncryptionPartDef encryptionPartDef = new EncryptionPartDef();
                     encryptionPartDef.setModifier(securePart.getModifier());



Mime
View raw message