You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/01/28 22:38:15 UTC

svn commit: r1780749 - in /axis/axis2/java/rampart/branches/RAMPART-433/modules: rampart-core/src/main/java/org/apache/rampart/policy/builders/ rampart-core/src/main/java/org/apache/rampart/policy/model/ rampart-core/src/test/java/org/apache/rampart/po...

Author: veithen
Date: Sat Jan 28 22:38:15 2017
New Revision: 1780749

URL: http://svn.apache.org/viewvc?rev=1780749&view=rev
Log:
More cleanup.

Modified:
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/main/java/org/apache/rampart/policy/builders/KerberosConfigBuilder.java
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/main/java/org/apache/rampart/policy/model/KerberosConfig.java
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/test/java/org/apache/rampart/policy/builders/KerberosConfigBuilderTest.java
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/pom.xml
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationService.java
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationServiceValidator.java
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/KerberosTokenBuilder.java
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/KerberosTokenBuilder.java

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/main/java/org/apache/rampart/policy/builders/KerberosConfigBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/main/java/org/apache/rampart/policy/builders/KerberosConfigBuilder.java?rev=1780749&r1=1780748&r2=1780749&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/main/java/org/apache/rampart/policy/builders/KerberosConfigBuilder.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/main/java/org/apache/rampart/policy/builders/KerberosConfigBuilder.java Sat Jan 28 22:38:15 2017
@@ -28,11 +28,6 @@ import org.apache.rampart.policy.model.R
  * Builder for {@link KerberosConfig} assertion.
  */
 public class KerberosConfigBuilder implements AssertionBuilder<OMElement> {
-
-    /* (non-Javadoc)
-     * @see org.apache.neethi.builders.AssertionBuilder#build(java.lang.Object, 
-     * org.apache.neethi.AssertionBuilderFactory)
-     */
     public Assertion build(OMElement element, AssertionBuilderFactory factory) 
         throws IllegalArgumentException {
 
@@ -93,9 +88,6 @@ public class KerberosConfigBuilder imple
         return kerberosConfig;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.neethi.builders.AssertionBuilder#getKnownElements()
-     */
     public QName[] getKnownElements() {
         return new QName[] {
             new QName(RampartConfig.NS, KerberosConfig.KERBEROS_LN) 

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/main/java/org/apache/rampart/policy/model/KerberosConfig.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/main/java/org/apache/rampart/policy/model/KerberosConfig.java?rev=1780749&r1=1780748&r2=1780749&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/main/java/org/apache/rampart/policy/model/KerberosConfig.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/main/java/org/apache/rampart/policy/model/KerberosConfig.java Sat Jan 28 22:38:15 2017
@@ -47,6 +47,7 @@ public class KerberosConfig implements A
     public final static String REQUEST_CREDENTIAL_DELEGATION_LN  = "requestCredentialDelegation";
     
     public final static String DELEGATION_CREDENTIAL_LN = "delegationCredential";
+
     /**
      * Specifies that the service principal name should be interpreted as a 
      * "host-based" name as specified in GSS API RFC, 
@@ -87,6 +88,7 @@ public class KerberosConfig implements A
     public String getJaasContext() {
         return jaasContext;
     }
+
     /**
      * Sets the JAAS context name to use to obtain a TGT (Ticket granting ticket).
      * @param jaasContext the jaasContext to set

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/test/java/org/apache/rampart/policy/builders/KerberosConfigBuilderTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/test/java/org/apache/rampart/policy/builders/KerberosConfigBuilderTest.java?rev=1780749&r1=1780748&r2=1780749&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/test/java/org/apache/rampart/policy/builders/KerberosConfigBuilderTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-core/src/test/java/org/apache/rampart/policy/builders/KerberosConfigBuilderTest.java Sat Jan 28 22:38:15 2017
@@ -47,7 +47,7 @@ public class KerberosConfigBuilderTest e
 
     public static final String KERBEROS_CONFIG_POLICY_FILE = "kerberosConfig.policy";
     
-    private static Log log = LogFactory.getLog(KerberosConfigBuilderTest.class);
+    private static final Log log = LogFactory.getLog(KerberosConfigBuilderTest.class);
     
     public void testBuildKerberosConfig() throws WSSPolicyException {
         Policy kerberosConfigPolicy = loadKerberosConfigPolicy();

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/pom.xml?rev=1780749&r1=1780748&r2=1780749&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/pom.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/pom.xml Sat Jan 28 22:38:15 2017
@@ -410,7 +410,7 @@
             </plugin>
         </plugins>
     </build>
-    
+
     <dependencies>
         <dependency>
             <groupId>org.apache.rampart</groupId>
@@ -490,78 +490,6 @@
             <artifactId>addressing</artifactId>
             <type>mar</type>
         </dependency>
-        <!--dependency>
-            <groupId>org.apache.directory.server</groupId>
-            <artifactId>apacheds-kerberos-shared</artifactId>
-            <version>2.0.0-M21</version>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>bouncycastle</groupId>
-                    <artifactId>bcprov-jdk15</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.server</groupId>
-                    <artifactId>apacheds-i18n</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.server</groupId>
-                    <artifactId>apacheds-core-jndi</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.server</groupId>
-                    <artifactId>apacheds-protocol-shared</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.shared</groupId>
-                    <artifactId>shared-ldap</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.shared</groupId>
-                    <artifactId>shared-ldap-schema</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.shared</groupId>
-                    <artifactId>shared-ldap-schema-loader</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.shared</groupId>
-                    <artifactId>shared-ldap-schema-manager</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.shared</groupId>
-                    <artifactId>shared-cursor</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.shared</groupId>
-                    <artifactId>shared-ldap-jndi</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.shared</groupId>
-                    <artifactId>shared-asn1-codec</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.shared</groupId>
-                    <artifactId>shared-ldap-constants</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.shared</groupId>
-                    <artifactId>shared-ldap-converter</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.shared</groupId>
-                    <artifactId>shared-ldap-schema-dao</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.shared</groupId>
-                    <artifactId>shared-ldif</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.directory.shared</groupId>
-                    <artifactId>shared-dsml-parser</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency-->
         <dependency>
             <groupId>org.apache.directory.server</groupId>
             <artifactId>apacheds-core-annotations</artifactId>

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationService.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationService.java?rev=1780749&r1=1780748&r2=1780749&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationService.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationService.java Sat Jan 28 22:38:15 2017
@@ -11,12 +11,7 @@ import org.apache.neethi.Policy;
 import org.apache.rampart.policy.model.KerberosConfig;
 import org.apache.rampart.policy.model.RampartConfig;
 
-/**
- * 
- */
 public class KerberosDelegationService extends PolicyBasedResultsValidator{
-    
-    
     public OMElement echo(OMElement elem) throws Exception {
         final String serviceName = "KerberosOverTransportKeytab";
 
@@ -61,6 +56,5 @@ public class KerberosDelegationService e
      */
     public OMElement returnError(OMElement element) throws Exception {
         throw new Exception("Testing negative scenarios with Apache Rampart. Intentional Exception");
-    }    
-    
+    }
 }

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationServiceValidator.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationServiceValidator.java?rev=1780749&r1=1780748&r2=1780749&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationServiceValidator.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationServiceValidator.java Sat Jan 28 22:38:15 2017
@@ -6,19 +6,12 @@ import org.apache.ws.security.WSConstant
 import org.apache.ws.security.WSSecurityEngineResult;
 import org.ietf.jgss.GSSCredential;
 
-/**
- * 
- */
 public class KerberosDelegationServiceValidator extends PolicyBasedResultsValidator {
-    
-    private static GSSCredential delegationCredential = null;
+    private static GSSCredential delegationCredential;
 
     @Override
     public void validate(ValidatorData data, List<WSSecurityEngineResult> results) throws RampartException {
-
         super.validate(data, results);
-        
-
         for (WSSecurityEngineResult wsSecEngineResult : results) {
             Integer actInt = (Integer) wsSecEngineResult.get(WSSecurityEngineResult.TAG_ACTION);
             if (actInt == WSConstants.BST) {                
@@ -32,5 +25,4 @@ public class KerberosDelegationServiceVa
     static GSSCredential getDelegationCredential(){
         return delegationCredential;
     }
-
 }

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/KerberosTokenBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/KerberosTokenBuilder.java?rev=1780749&r1=1780748&r2=1780749&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/KerberosTokenBuilder.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/KerberosTokenBuilder.java Sat Jan 28 22:38:15 2017
@@ -35,13 +35,6 @@ import org.apache.ws.secpolicy.model.Ker
  * Builder for {@link KerberosToken} assertion (WS Security Policy version 1.1)
  */
 public class KerberosTokenBuilder implements AssertionBuilder<OMElement> {
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.neethi.builders.AssertionBuilder#build(java.lang.Object,
-     * org.apache.neethi.AssertionBuilderFactory)
-     */
     public Assertion build(OMElement element, AssertionBuilderFactory arg1) 
             throws IllegalArgumentException {
         KerberosToken kerberosToken = new KerberosToken(SPConstants.SP_V11);
@@ -59,9 +52,9 @@ public class KerberosTokenBuilder implem
 
         if (policyElement != null) {
             Policy policy = PolicyEngine.getPolicy(element.getFirstElement());
-            policy = (Policy) policy.normalize(false);
-            for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
-                processAlternative((List) iterator.next(), kerberosToken);
+            policy = policy.normalize(false);
+            for (Iterator<List<Assertion>> iterator = policy.getAlternatives(); iterator.hasNext();) {
+                processAlternative(iterator.next(), kerberosToken);
                  // there should be only one alternative
                 break;
             }
@@ -69,13 +62,9 @@ public class KerberosTokenBuilder implem
         return kerberosToken;
     }
 
-    private void processAlternative(List assertions, KerberosToken parent) {
-        Assertion assertion;
-        QName name;
-
-        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
-            assertion = (Assertion) iterator.next();
-            name = assertion.getName();
+    private void processAlternative(List<Assertion> assertions, KerberosToken parent) {
+        for (Assertion assertion : assertions) {
+            QName name = assertion.getName();
             if (SP11Constants.REQUIRE_KERBEROS_V5_TOKEN_11.equals(name)) {
                 parent.setRequiresKerberosV5Token(true);
             } else if (SP11Constants.REQUIRE_KERBEROS_GSS_V5_TOKEN_11.equals(name)) {

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/KerberosTokenBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/KerberosTokenBuilder.java?rev=1780749&r1=1780748&r2=1780749&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/KerberosTokenBuilder.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/KerberosTokenBuilder.java Sat Jan 28 22:38:15 2017
@@ -35,13 +35,6 @@ import org.apache.ws.secpolicy.model.Ker
  * Builder for {@link KerberosToken} assertion (WS Security Policy version 1.2)
  */
 public class KerberosTokenBuilder implements AssertionBuilder<OMElement> {
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.neethi.builders.AssertionBuilder#build(java.lang.Object,
-     * org.apache.neethi.AssertionBuilderFactory)
-     */
     public Assertion build(OMElement element, AssertionBuilderFactory arg1) 
             throws IllegalArgumentException {
         KerberosToken kerberosToken = new KerberosToken(SPConstants.SP_V12);
@@ -59,9 +52,9 @@ public class KerberosTokenBuilder implem
 
         if (policyElement != null) {
             Policy policy = PolicyEngine.getPolicy(element.getFirstElement());
-            policy = (Policy) policy.normalize(false);
-            for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
-                processAlternative((List) iterator.next(), kerberosToken);
+            policy = policy.normalize(false);
+            for (Iterator<List<Assertion>> iterator = policy.getAlternatives(); iterator.hasNext();) {
+                processAlternative(iterator.next(), kerberosToken);
                  // there should be only one alternative
                 break;
             }
@@ -69,13 +62,9 @@ public class KerberosTokenBuilder implem
         return kerberosToken;
     }
 
-    private void processAlternative(List assertions, KerberosToken parent) {
-        Assertion assertion;
-        QName name;
-
-        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
-            assertion = (Assertion) iterator.next();
-            name = assertion.getName();
+    private void processAlternative(List<Assertion> assertions, KerberosToken parent) {
+        for (Assertion assertion : assertions) {
+            QName name = assertion.getName();
             if (SP12Constants.REQUIRE_KERBEROS_V5_TOKEN_11.equals(name)) {
                 parent.setRequiresKerberosV5Token(true);
             } else if (SP12Constants.REQUIRE_KERBEROS_GSS_V5_TOKEN_11.equals(name)) {