You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by km...@apache.org on 2013/09/13 03:00:36 UTC

[2/5] KNOX-118: Add rewrite functions to allow use of service registry within rewrite rules. Also includes initial integration of this with Oozie.

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncryptProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncryptProcessor.java b/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncryptProcessor.java
new file mode 100644
index 0000000..df75a1b
--- /dev/null
+++ b/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncryptProcessor.java
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.gateway.securequery;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
+import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
+import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor;
+import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepStatus;
+import org.apache.hadoop.gateway.util.urltemplate.Parser;
+import org.apache.hadoop.gateway.util.urltemplate.Template;
+
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+
+public class SecureQueryEncryptProcessor
+    implements UrlRewriteStepProcessor<SecureQueryEncryptDescriptor> {
+
+  private static final String ENCRYPTED_PARAMETER_NAME = "_";
+
+  private String clusterName;
+
+  @Override
+  public String getType() {
+    return SecureQueryEncryptDescriptor.STEP_NAME;
+  }
+
+  @Override
+  public void initialize( UrlRewriteEnvironment environment, SecureQueryEncryptDescriptor descriptor ) throws Exception {
+    List<String> values = environment.resolve( "cluster.name" );
+    if( values != null && values.size() > 0 ) {
+      this.clusterName = environment.resolve( "cluster.name" ).get( 0 );
+    }
+  }
+
+  @Override
+  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
+    //TODO: Need some way to get a reference to the keystore service and the encryption key in particular.
+    Template url = context.getCurrentUrl();
+    String str = url.toString();
+    String path = str;
+    String query = null;
+    int index = str.indexOf( '?' );
+    if( index >= 0 ) {
+      path = str.substring( 0, index );
+      if( index < str.length() ) {
+        query = str.substring( index + 1 );
+      }
+    }
+    if( query != null ) {
+      query = encode( query );
+      url = Parser.parse( path + "?" + ENCRYPTED_PARAMETER_NAME +"=" + query );
+      context.setCurrentUrl( url );
+    }
+    return UrlRewriteStepStatus.SUCCESS;
+  }
+
+  @Override
+  public void destroy() {
+  }
+
+  private String encode( String string ) throws UnsupportedEncodingException {
+    string = Base64.encodeBase64String( string.getBytes( "UTF-8" ) );
+    string = removeTrailingEquals( string );
+    return string;
+  }
+
+  private static String removeTrailingEquals( String s ) {
+    int i = s.length()-1;
+    while( i > 0 && s.charAt( i ) == '=' ) {
+      i--;
+    }
+    return s.substring( 0, i+1 );
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite-step-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor b/gateway-provider-rewrite-step-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor
new file mode 100644
index 0000000..14ed327
--- /dev/null
+++ b/gateway-provider-rewrite-step-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor
@@ -0,0 +1,19 @@
+##########################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##########################################################################
+
+org.apache.hadoop.gateway.securequery.SecureQueryDeploymentContributor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite-step-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor b/gateway-provider-rewrite-step-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor
new file mode 100644
index 0000000..c5f9376
--- /dev/null
+++ b/gateway-provider-rewrite-step-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor
@@ -0,0 +1,22 @@
+##########################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##########################################################################
+
+org.apache.hadoop.gateway.securequery.SecureQueryEncodeDescriptor
+org.apache.hadoop.gateway.securequery.SecureQueryDecodeDescriptor
+org.apache.hadoop.gateway.securequery.SecureQueryEncryptDescriptor
+org.apache.hadoop.gateway.securequery.SecureQueryDecryptDescriptor

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite-step-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor b/gateway-provider-rewrite-step-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor
new file mode 100644
index 0000000..f216d77
--- /dev/null
+++ b/gateway-provider-rewrite-step-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor
@@ -0,0 +1,22 @@
+##########################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##########################################################################
+
+org.apache.hadoop.gateway.securequery.SecureQueryEncodeProcessor
+org.apache.hadoop.gateway.securequery.SecureQueryDecodeProcessor
+org.apache.hadoop.gateway.securequery.SecureQueryEncryptProcessor
+org.apache.hadoop.gateway.securequery.SecureQueryDecryptProcessor

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeDescriptorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeDescriptorTest.java b/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeDescriptorTest.java
new file mode 100644
index 0000000..cb496e8
--- /dev/null
+++ b/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeDescriptorTest.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.gateway.securequery;
+
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class SecureQueryDecodeDescriptorTest {
+
+  @Test
+  public void testGetAndSet() {
+    SecureQueryDecodeDescriptor descriptor = new SecureQueryDecodeDescriptor();
+    assertThat( descriptor.type(), is( "decode-query" ) );
+    assertThat( descriptor.getParam(), nullValue() );
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeProcessorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeProcessorTest.java b/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeProcessorTest.java
new file mode 100644
index 0000000..e8af9ce
--- /dev/null
+++ b/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeProcessorTest.java
@@ -0,0 +1,125 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.gateway.securequery;
+
+import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
+import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
+import org.apache.hadoop.gateway.util.urltemplate.Parser;
+import org.apache.hadoop.gateway.util.urltemplate.Template;
+import org.easymock.Capture;
+import org.easymock.EasyMock;
+import org.junit.Test;
+import sun.misc.BASE64Encoder;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class SecureQueryDecodeProcessorTest {
+
+  @Test
+  public void testSimpleQueryDecode() throws Exception {
+    UrlRewriteEnvironment environment = new UrlRewriteEnvironment() {
+      @Override
+      public URL getResource( String name ) throws IOException {
+        return null;
+      }
+
+      @Override
+      public <T> T getAttribute( String name ) {
+        return null;
+      }
+
+      @Override
+      public List<String> resolve( String name ) {
+        return null;
+      }
+    };
+
+    BASE64Encoder encoder = new BASE64Encoder();
+    String encQuery = encoder.encode( "test-query".getBytes("utf-8" ) );
+    encQuery = encQuery.replaceAll( "\\=", "" );
+    String inString = "http://host:0/root/path?_=" + encQuery;
+    Template inTemplate = Parser.parse( inString );
+
+    UrlRewriteContext context = EasyMock.createNiceMock( UrlRewriteContext.class );
+    EasyMock.expect( context.getCurrentUrl() ).andReturn( inTemplate );
+    Capture<Template> outTemplate = new Capture<Template>();
+    context.setCurrentUrl( EasyMock.capture( outTemplate ) );
+    EasyMock.replay( context );
+
+    SecureQueryDecodeDescriptor descriptor = new SecureQueryDecodeDescriptor();
+    SecureQueryDecodeProcessor processor = new SecureQueryDecodeProcessor();
+    processor.initialize( environment, descriptor );
+    processor.process( context );
+
+    String outActual = outTemplate.getValue().toString();
+    assertThat( outActual, is( "http://host:0/root/path?test-query" ) );
+  }
+
+  @Test
+  public void testDecodeQueryWithNonEncodedParams() throws Exception {
+    UrlRewriteEnvironment environment = new UrlRewriteEnvironment() {
+      @Override
+      public URL getResource( String name ) throws IOException {
+        return null;
+      }
+
+      @Override
+      public <T> T getAttribute( String name ) {
+        return null;
+      }
+
+      @Override
+      public List<String> resolve( String name ) {
+        return null;
+      }
+    };
+
+    BASE64Encoder encoder = new BASE64Encoder();
+    String inQuery = "test-query=test-value";
+    String encQuery = encoder.encode( inQuery.getBytes( "utf-8" ) );
+    encQuery = encQuery.replaceAll( "\\=", "" );
+    String inString = "http://host:0/root/path?_=" + encQuery + "&clear-param=clear-value";
+    Template inTemplate = Parser.parse( inString );
+
+    UrlRewriteContext context = EasyMock.createNiceMock( UrlRewriteContext.class );
+    EasyMock.expect( context.getCurrentUrl() ).andReturn( inTemplate );
+    Capture<Template> outTemplate = new Capture<Template>();
+    context.setCurrentUrl( EasyMock.capture( outTemplate ) );
+    EasyMock.replay( context );
+
+    SecureQueryDecodeDescriptor descriptor = new SecureQueryDecodeDescriptor();
+    SecureQueryDecodeProcessor processor = new SecureQueryDecodeProcessor();
+    processor.initialize( environment, descriptor );
+    processor.process( context );
+
+    String outActual = outTemplate.getValue().toString();
+    assertThat( outActual, containsString( "http://host:0/root/path?" ) );
+    assertThat( outActual, containsString( "test-query=test-value" ) );
+    assertThat( outActual, containsString( "clear-param=clear-value" ) );
+    assertThat( outActual, not( containsString( encQuery ) ) );
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDeploymentContributorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDeploymentContributorTest.java b/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDeploymentContributorTest.java
new file mode 100644
index 0000000..c337d7e
--- /dev/null
+++ b/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDeploymentContributorTest.java
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.gateway.securequery;
+
+import org.apache.hadoop.gateway.deploy.DeploymentContext;
+import org.apache.hadoop.gateway.topology.Provider;
+import org.easymock.EasyMock;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class SecureQueryDeploymentContributorTest {
+
+  @Test
+  public void testDeployment() throws IOException {
+    WebArchive webArchive = ShrinkWrap.create( WebArchive.class, "test-acrhive" );
+
+//    UrlRewriteRulesDescriptorImpl rewriteRules = new UrlRewriteRulesDescriptorImpl();
+
+    Map<String,String> providerParams = new HashMap<String, String>();
+//    providerParams.put( "test-host-external", "test-host-internal" );
+    Provider provider = new Provider();
+    provider.setEnabled( true );
+    provider.setName( "secure-query" );
+    provider.setParams(  providerParams );
+
+    DeploymentContext context = EasyMock.createNiceMock( DeploymentContext.class );
+//    EasyMock.expect( context.getDescriptor( "rewrite" ) ).andReturn( rewriteRules ).anyTimes();
+    EasyMock.expect( context.getWebArchive() ).andReturn( webArchive ).anyTimes();
+    EasyMock.replay( context );
+
+    SecureQueryDeploymentContributor contributor = new SecureQueryDeploymentContributor();
+
+    assertThat( contributor.getRole(), is( "secure-query" ) );
+    assertThat( contributor.getName(), is( "default" ) );
+
+    // Just make sure it doesn't blow up.
+    contributor.contributeFilter( null, null, null, null, null );
+
+    // Just make sure it doesn't blow up.
+    contributor.initializeContribution( context );
+
+    contributor.contributeProvider( context, provider );
+
+//    HostmapFunctionDescriptor funcDesc = rewriteRules.getFunction( "hostmap" );
+//    assertThat( funcDesc.config(), is( "/WEB-INF/hostmap.txt" ) );
+//
+//    Node node = webArchive.get( "/WEB-INF/hostmap.txt" );
+//    String asset = IOUtils.toString( node.getAsset().openStream() );
+//    assertThat( asset, containsString( "test-host-external=test-host-internal" ) );
+
+    // Just make sure it doesn't blow up.
+    contributor.finalizeContribution( context );
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeDescriptorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeDescriptorTest.java b/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeDescriptorTest.java
new file mode 100644
index 0000000..bdf1ad0
--- /dev/null
+++ b/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeDescriptorTest.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.gateway.securequery;
+
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class SecureQueryEncodeDescriptorTest {
+
+  @Test
+  public void testGetAndSet() {
+    SecureQueryEncodeDescriptor descriptor = new SecureQueryEncodeDescriptor();
+    assertThat( descriptor.type(), is( "encode-query" ) );
+    assertThat( descriptor.getParam(), nullValue() );
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeProcessorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeProcessorTest.java b/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeProcessorTest.java
new file mode 100644
index 0000000..4003be3
--- /dev/null
+++ b/gateway-provider-rewrite-step-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeProcessorTest.java
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.gateway.securequery;
+
+import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
+import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
+import org.apache.hadoop.gateway.util.urltemplate.Parser;
+import org.apache.hadoop.gateway.util.urltemplate.Template;
+import org.easymock.Capture;
+import org.easymock.EasyMock;
+import org.junit.Test;
+import sun.misc.BASE64Encoder;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class SecureQueryEncodeProcessorTest {
+
+  @Test
+  public void testSimpleQueryEncoding() throws Exception {
+    UrlRewriteEnvironment environment = EasyMock.createNiceMock( UrlRewriteEnvironment.class );
+
+    Template inTemplate = Parser.parse( "http://host:0/root/path?query" );
+    UrlRewriteContext context = EasyMock.createNiceMock( UrlRewriteContext.class );
+    EasyMock.expect( context.getCurrentUrl() ).andReturn( inTemplate );
+    Capture<Template> outTemplate = new Capture<Template>();
+    context.setCurrentUrl( EasyMock.capture( outTemplate ) );
+
+    EasyMock.replay( environment, context );
+
+    SecureQueryEncodeDescriptor descriptor = new SecureQueryEncodeDescriptor();
+    SecureQueryEncodeProcessor processor = new SecureQueryEncodeProcessor();
+    processor.initialize( environment, descriptor );
+    processor.process( context );
+
+    BASE64Encoder encoder = new BASE64Encoder();
+    String encQuery = encoder.encode( "query".getBytes("utf-8" ) );
+    encQuery = encQuery.replaceAll( "\\=", "" );
+    String outExpect = "http://host:0/root/path?_=" + encQuery;
+    String outActual = outTemplate.getValue().toString();
+    assertThat( outActual, is( outExpect ) );
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessor.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessor.java
index 600b04d..a6efaf0 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessor.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessor.java
@@ -74,8 +74,8 @@ public class UrlRewriteProcessor implements UrlRewriter {
         processor.initialize( environment, descriptor );
         functions.put( name, processor );
       } catch( Exception e ) {
-        LOG.failedToInitializeRewriteFunctions( e );
         // Ignore it and it won't be available as a function.
+        LOG.failedToInitializeRewriteFunctions( e );
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptor.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptor.java
index 8092459..461a272 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptor.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteRulesDescriptor.java
@@ -24,6 +24,8 @@ import java.util.List;
  */
 public interface UrlRewriteRulesDescriptor {
 
+  void addRules( UrlRewriteRulesDescriptor rules );
+
   List<UrlRewriteFunctionDescriptor> getFunctions();
 
   <T extends UrlRewriteFunctionDescriptor<?>> T getFunction( String name );

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteRulesDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteRulesDescriptorImpl.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteRulesDescriptorImpl.java
index a59c90c..5e0043f 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteRulesDescriptorImpl.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteRulesDescriptorImpl.java
@@ -38,6 +38,16 @@ public class UrlRewriteRulesDescriptorImpl implements UrlRewriteRulesDescriptor
   private Map<String,UrlRewriteFilterDescriptor> filterMap = new HashMap<String,UrlRewriteFilterDescriptor>();
 
   @Override
+  public void addRules( UrlRewriteRulesDescriptor rules ) {
+    for( UrlRewriteRuleDescriptor rule : rules.getRules() ) {
+      addRule( rule );
+    }
+    for( UrlRewriteFilterDescriptor filter : rules.getFilters() ) {
+      addFilter( filter  );
+    }
+  }
+
+  @Override
   public UrlRewriteRuleDescriptor getRule( String name ) {
     return ruleMap.get( name );
   }

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java
index 3fdb896..b01b656 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java
@@ -163,8 +163,18 @@ public class UrlRewriteProcessorTest {
         "xml", getTestResourceReader( "rewrite.xml", "UTF-8" ) );
     processor.initialize( environment, config );
 
-    Template inputUrl = Parser.parse( "test-scheme-input://test-host-input:42/test-path-input-one/test-path-input-two" );
-    Template outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.OUT, "test-rule-2" );
+    Template inputUrl;
+    Template outputUrl;
+
+    inputUrl = Parser.parse( "test-scheme-input://test-host-input:42/test-path-input-one/test-path-input-two?test-query-name=test-query-value" );
+    outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.OUT, "test-rule-2" );
+
+    assertThat(
+        "Expect rewrite to contain the correct path and query.",
+        outputUrl.toString(), is( "test-scheme-output://test-host-output:777/test-path-output/test-path-input-one/test-path-input-two?test-query-name=test-query-value" ) );
+
+    inputUrl = Parser.parse( "test-scheme-input://test-host-input:42/test-path-input-one/test-path-input-two" );
+    outputUrl = processor.rewrite( null, inputUrl, UrlRewriter.Direction.OUT, "test-rule-2" );
 
     assertThat(
         "Expect rewrite to contain the correct path.",

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
index 9030689..c1b535e 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
@@ -29,7 +29,6 @@ import org.eclipse.jetty.testing.HttpTester;
 import org.eclipse.jetty.testing.ServletTester;
 import org.eclipse.jetty.util.ArrayQueue;
 import org.eclipse.jetty.util.log.Log;
-import org.eclipse.jetty.util.log.Logger;
 import org.junit.After;
 import org.junit.Ignore;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest.java
index 833a927..de112e6 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest.java
@@ -93,6 +93,33 @@ public class JsonFilterReaderTest {
     JsonAssert.with( output ).assertThat( "name<test-str>", is( "value:null<text>" ) );
   }
 
+  @Test
+  public void testNamesWithDots() throws IOException {
+    InputStream stream = TestUtils.getResourceStream( this.getClass(), "dotted-field-name.json" );
+    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+
+    //System.out.println( "INPUT=" + input );
+
+    UrlRewriteRulesDescriptor rulesConfig = UrlRewriteRulesDescriptorFactory.create();
+    UrlRewriteFilterDescriptor filterConfig = rulesConfig.addFilter( "test-filter" );
+    UrlRewriteFilterContentDescriptor contentConfig = filterConfig.addContent( "application/json" );
+    //NOTE: The field names are rewritten first so the values rules need to match the rewritten name.
+    contentConfig.addApply( "$.name<testField>", "test-rule" );
+    contentConfig.addApply( "$.name<test_field>", "test-rule" );
+    contentConfig.addApply( "$.name<test-field>", "test-rule" );
+    contentConfig.addApply( "$['name<test.field>']", "test-rule" );
+
+    JsonFilterReader filter = new TestJsonFilterReader( new StringReader( input ), contentConfig );
+    String output = IOUtils.toString( filter );
+
+    //System.out.println( "OUTPUT=" + output );
+
+    JsonAssert.with( output ).assertThat( "$['name<testField>']", is( "value:test-rule<testField value>" ) );
+    JsonAssert.with( output ).assertThat( "$['name<test_field>']", is( "value:test-rule<test_field value>" ) );
+    JsonAssert.with( output ).assertThat( "$['name<test-field>']", is( "value:test-rule<test-field value>" ) );
+    JsonAssert.with( output ).assertThat( "$['name<test.field>']", is( "value:test-rule<test.field value>" ) );
+  }
+
 //  @Test
 //  public void testJsonPathObject() throws IOException {
 //    InputStream stream = TestUtils.getResourceStream( this.getClass(), "complex.json" );

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
index 89257c4..ad51cc8 100644
--- a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest/rewrite.xml
@@ -17,11 +17,36 @@
 <rules>
 
     <rule name="test-rule-1" url="{scheme=*}://{host=*}:{port=*}/{path=**}">
-        <rewrite param="{scheme}://{host}:{port}/test-output-path-1"/>
+        <rewrite template="{scheme}://{host}:{port}/test-output-path-1"/>
     </rule>
 
     <rule name="test-rule-2" url="{scheme=*}://{host=*}:{port=*}/{path=**}">
-        <rewrite param="{scheme}://{host}:{port}/test-output-path-2"/>
+        <rewrite template="{scheme}://{host}:{port}/test-output-path-2"/>
+    </rule>
+
+    <rule name="test-rule-username">
+        <match pattern="*://{host}:{port}/{path=**}?{**}"/>
+        <rewrite template="test-output-scheme://{host}:{port}/test-output-path/{path=**}?user.name={$username}?{**}?test-output-query-name=test-output-query-value"/>
+    </rule>
+
+    <rule name="test-rule-scvreg-all">
+        <match pattern="{*}://{*}:{*}/{**}?{**}"/>
+        <rewrite template="{$serviceScheme[NAMENODE]}://{$serviceHost[NAMENODE]:{$servicePort[NAMENOCE]}/{$servicePath[NAMENODE]}"/>
+    </rule>
+
+    <rule name="test-rule-scvreg-url">
+        <match pattern="{*}://{*}:{*}/{**}?{**}"/>
+        <rewrite template="{$serviceScheme[NAMENODE]}://{$serviceHost[NAMENODE]:{$servicePort[NAMENOCE]}/{$servicePath[NAMENODE]}"/>
+    </rule>
+
+    <rule name="test-rule-scvreg-addr">
+        <match pattern="{*}://{*}:{*}/{**}?{**}"/>
+        <rewrite template="{$serviceUrl[NAMENODE]}"/>
+    </rule>
+
+    <rule name="test-rule-scvreg-addr">
+        <match pattern="{*}://{*}:{*}/{**}?{**}"/>
+        <rewrite template="test-protocol://{$serviceAddr[NAMENODE]}/test-path"/>
     </rule>
 
     <filter name="test-filter-1">

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/dotted-field-name.json
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/dotted-field-name.json b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/dotted-field-name.json
new file mode 100644
index 0000000..bb18642
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReaderTest/dotted-field-name.json
@@ -0,0 +1,6 @@
+{
+  "testField": "testField value",
+  "test_field": "test_field value",
+  "test-field": "test-field value",
+  "test.field": "test.field value"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/pom.xml b/gateway-provider-secure-query/pom.xml
deleted file mode 100644
index 829e719..0000000
--- a/gateway-provider-secure-query/pom.xml
+++ /dev/null
@@ -1,106 +0,0 @@
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <artifactId>gateway</artifactId>
-        <groupId>org.apache.hadoop</groupId>
-        <version>0.3.0-SNAPSHOT</version>
-    </parent>
-    <artifactId>gateway-provider-secure-query</artifactId>
-
-    <name>gateway-provider-secure-query</name>
-    <description>An extension of the gateway that supports securing query parameters.</description>
-
-    <licenses>
-        <license>
-            <name>The Apache Software License, Version 2.0</name>
-            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
-            <distribution>repo</distribution>
-        </license>
-    </licenses>
-
-    <dependencies>
-
-        <dependency>
-            <groupId>${gateway-group}</groupId>
-            <artifactId>gateway-util-common</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${gateway-group}</groupId>
-            <artifactId>gateway-util-urltemplate</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${gateway-group}</groupId>
-            <artifactId>gateway-i18n</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${gateway-group}</groupId>
-            <artifactId>gateway-i18n-logging-log4j</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${gateway-group}</groupId>
-            <artifactId>gateway-spi</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${gateway-group}</groupId>
-            <artifactId>gateway-provider-rewrite</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
-        </dependency>
-
-        <!-- ********** ********** ********** ********** ********** ********** -->
-        <!-- ********** Test Dependencies                           ********** -->
-        <!-- ********** ********** ********** ********** ********** ********** -->
-
-        <dependency>
-            <groupId>${gateway-group}</groupId>
-            <artifactId>gateway-test-utils</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>hamcrest-core</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>hamcrest-library</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- This must be after restassured otherwise is messes up the hamcrest dependencies. -->
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymock</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-    </dependencies>
-
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeDescriptor.java b/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeDescriptor.java
deleted file mode 100644
index f026e38..0000000
--- a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeDescriptor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.gateway.securequery;
-
-import org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteActionDescriptor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteActionDescriptorBase;
-
-public class SecureQueryDecodeDescriptor
-    extends UrlRewriteActionDescriptorBase
-    implements UrlRewriteActionDescriptor {
-
-  static final String STEP_NAME = "decode-query";
-
-  public SecureQueryDecodeDescriptor() {
-    super( STEP_NAME );
-  }
-
-  @Override
-  public String getParam() {
-    return null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeProcessor.java b/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeProcessor.java
deleted file mode 100644
index 37eec1c..0000000
--- a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeProcessor.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.gateway.securequery;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepStatus;
-import org.apache.hadoop.gateway.util.urltemplate.Builder;
-import org.apache.hadoop.gateway.util.urltemplate.Query;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-public class SecureQueryDecodeProcessor implements UrlRewriteStepProcessor<SecureQueryDecodeDescriptor> {
-
-  private static final String ENCODED_PARAMETER_NAME = "_";
-
-  @Override
-  public String getType() {
-    return SecureQueryDecodeDescriptor.STEP_NAME;
-  }
-
-  @Override
-  public void initialize( UrlRewriteEnvironment environment, SecureQueryDecodeDescriptor descriptor ) throws Exception {
-  }
-
-  @Override
-  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
-    //TODO: Need some way to get a reference to the keystore service and the encryption key in particular.
-    Template currUrl = context.getCurrentUrl();
-    Builder newUrl = new Builder( currUrl );
-    Map<String,Query> map = newUrl.getQuery();
-    Query query = map.remove( ENCODED_PARAMETER_NAME );
-    if( query != null ) {
-      String value = query.getFirstValue().getPattern();
-      value = decode( value );
-      StringTokenizer outerParser = new StringTokenizer( value, "&" );
-      while( outerParser.hasMoreTokens() ) {
-        String pair = outerParser.nextToken();
-        StringTokenizer innerParser = new StringTokenizer( pair, "=" );
-        if( innerParser.hasMoreTokens() ) {
-          String paramName = innerParser.nextToken();
-          if( innerParser.hasMoreTokens() ) {
-            String paramValue = innerParser.nextToken();
-            // Need to take out any existing query param.
-            // If we don't then someone could override something in the encoded param.
-            map.remove( paramName );
-            newUrl.addQuery( paramName, "", paramValue );
-          } else {
-            newUrl.addQuery( paramName, "", null );
-          }
-        }
-      }
-      context.setCurrentUrl( newUrl.build() );
-    }
-    return UrlRewriteStepStatus.SUCCESS;
-  }
-
-  @Override
-  public void destroy() {
-  }
-
-  private static String decode( String string ) throws UnsupportedEncodingException {
-    return new String( Base64.decodeBase64( string ), "UTF-8" );
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecryptDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecryptDescriptor.java b/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecryptDescriptor.java
deleted file mode 100644
index 8db2070..0000000
--- a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecryptDescriptor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.gateway.securequery;
-
-import org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteActionDescriptor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteActionDescriptorBase;
-
-public class SecureQueryDecryptDescriptor
-    extends UrlRewriteActionDescriptorBase
-    implements UrlRewriteActionDescriptor {
-
-  static final String STEP_NAME = "decrypt-query";
-
-  public SecureQueryDecryptDescriptor() {
-    super( STEP_NAME );
-  }
-
-  @Override
-  public String getParam() {
-    return null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecryptProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecryptProcessor.java b/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecryptProcessor.java
deleted file mode 100644
index 031e0fb..0000000
--- a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDecryptProcessor.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.gateway.securequery;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepStatus;
-import org.apache.hadoop.gateway.util.urltemplate.Builder;
-import org.apache.hadoop.gateway.util.urltemplate.Query;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-
-import java.io.UnsupportedEncodingException;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-public class SecureQueryDecryptProcessor implements UrlRewriteStepProcessor<SecureQueryDecryptDescriptor> {
-
-  private static final String ENCRYPTED_PARAMETER_NAME = "_";
-
-  private String clusterName;
-
-  @Override
-  public String getType() {
-    return SecureQueryDecryptDescriptor.STEP_NAME;
-  }
-
-  @Override
-  public void initialize( UrlRewriteEnvironment environment, SecureQueryDecryptDescriptor descriptor ) throws Exception {
-    List<String> values = environment.resolve( "cluster.name" );
-    if( values != null && values.size() > 0 ) {
-      this.clusterName = environment.resolve( "cluster.name" ).get( 0 );
-    }
-  }
-
-  @Override
-  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
-    //TODO: Need some way to get a reference to the keystore service and the encryption key in particular.
-    Template currUrl = context.getCurrentUrl();
-    Builder newUrl = new Builder( currUrl );
-    Map<String,Query> map = newUrl.getQuery();
-    Query query = map.remove( ENCRYPTED_PARAMETER_NAME );
-    if( query != null ) {
-      String value = query.getFirstValue().getPattern();
-      value = decode( value );
-      StringTokenizer outerParser = new StringTokenizer( value, "&" );
-      while( outerParser.hasMoreTokens() ) {
-        String pair = outerParser.nextToken();
-        StringTokenizer innerParser = new StringTokenizer( pair, "=" );
-        if( innerParser.hasMoreTokens() ) {
-          String paramName = innerParser.nextToken();
-          if( innerParser.hasMoreTokens() ) {
-            String paramValue = innerParser.nextToken();
-            // Need to remove from the clear parameters any param name in the encoded params.
-            // If we don't then someone could override something in the encoded param.
-            map.remove( paramName );
-            newUrl.addQuery( paramName, "", paramValue );
-          } else {
-            newUrl.addQuery( paramName, "", null );
-          }
-        }
-      }
-      context.setCurrentUrl( newUrl.build() );
-      context.getParameters().resolve( "gateway.name" );
-    }
-    return UrlRewriteStepStatus.SUCCESS;
-  }
-
-  @Override
-  public void destroy() {
-  }
-
-  private static String decode( String string ) throws UnsupportedEncodingException {
-    return new String( Base64.decodeBase64( string ), "UTF-8" );
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDeploymentContributor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDeploymentContributor.java b/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDeploymentContributor.java
deleted file mode 100644
index 2598eb2..0000000
--- a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryDeploymentContributor.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.gateway.securequery;
-
-import org.apache.hadoop.gateway.deploy.DeploymentContext;
-import org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor;
-import org.apache.hadoop.gateway.deploy.ProviderDeploymentContributorBase;
-import org.apache.hadoop.gateway.descriptor.FilterParamDescriptor;
-import org.apache.hadoop.gateway.descriptor.ResourceDescriptor;
-import org.apache.hadoop.gateway.topology.Provider;
-import org.apache.hadoop.gateway.topology.Service;
-
-import java.util.List;
-
-public class SecureQueryDeploymentContributor
-    extends ProviderDeploymentContributorBase
-    implements ProviderDeploymentContributor {
-
-  public static final String PROVIDER_ROLE_NAME = "secure-query";
-  public static final String PROVIDER_IMPL_NAME = "default";
-
-  @Override
-  public String getRole() {
-    return PROVIDER_ROLE_NAME;
-  }
-
-  @Override
-  public String getName() {
-    return PROVIDER_IMPL_NAME;
-  }
-
-  @Override
-  public void contributeProvider( DeploymentContext context, Provider provider ) {
-    if( provider.isEnabled() ) {
-      //TODO: Do something with the keystore service.
-//      UrlRewriteRulesDescriptor rules = context.getDescriptor( REWRITE_ROLE_NAME );
-//      if( rules != null ) {
-//        HostmapFunctionDescriptor func = rules.addFunction( HostmapFunctionDescriptor.FUNCTION_NAME );
-//        if( func != null ) {
-//          Asset asset = createAsset( provider );
-//          context.getWebArchive().addAsWebInfResource(
-//              asset, HostmapFunctionProcessor.DESCRIPTOR_DEFAULT_FILE_NAME );
-//          func.config( HostmapFunctionProcessor.DESCRIPTOR_DEFAULT_LOCATION );
-//        }
-//      }
-    }
-  }
-
-//  private Asset createAsset( Provider provider ) {
-//    StringWriter buffer = new StringWriter();
-//    PrintWriter writer = new PrintWriter( buffer );
-//    for( Map.Entry<String,String> entry : provider.getParams().entrySet() ) {
-//      String externalHosts = entry.getKey();
-//      String internalHosts = entry.getValue();
-//      writer.print( externalHosts );
-//      writer.print( "=" );
-//      writer.println( internalHosts ) ;
-//    }
-//    writer.close();
-//    String string = buffer.toString();
-//    Asset asset = new StringAsset( string );
-//    return asset;
-//  }
-
-  @Override
-  public void contributeFilter(
-      DeploymentContext context,
-      Provider provider,
-      Service service,
-      ResourceDescriptor resource,
-      List<FilterParamDescriptor> params ) {
-    //TODO: Might need to add a filter as a way to propigate a keystore service to the processor.
-    // NoOp.
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeDescriptor.java b/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeDescriptor.java
deleted file mode 100644
index a29be4e..0000000
--- a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeDescriptor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.gateway.securequery;
-
-import org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteActionDescriptor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteActionDescriptorBase;
-
-public class SecureQueryEncodeDescriptor
-    extends UrlRewriteActionDescriptorBase
-    implements UrlRewriteActionDescriptor {
-
-  static final String STEP_NAME = "encode-query";
-
-  public SecureQueryEncodeDescriptor() {
-    super( STEP_NAME );
-  }
-
-  @Override
-  public String getParam() {
-    return null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeProcessor.java b/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeProcessor.java
deleted file mode 100644
index eff1908..0000000
--- a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncodeProcessor.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.gateway.securequery;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepStatus;
-import org.apache.hadoop.gateway.util.urltemplate.Parser;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-
-public class SecureQueryEncodeProcessor
-    implements UrlRewriteStepProcessor<SecureQueryEncodeDescriptor> {
-
-  private static final String ENCODED_PARAMETER_NAME = "_";
-
-  @Override
-  public String getType() {
-    return SecureQueryEncodeDescriptor.STEP_NAME;
-  }
-
-  @Override
-  public void initialize( UrlRewriteEnvironment environment, SecureQueryEncodeDescriptor descriptor ) throws Exception {
-  }
-
-  @Override
-  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
-    //TODO: Need some way to get a reference to the keystore service and the encryption key in particular.
-    Template url = context.getCurrentUrl();
-    String str = url.toString();
-    String path = str;
-    String query = null;
-    int index = str.indexOf( '?' );
-    if( index >= 0 ) {
-      path = str.substring( 0, index );
-      if( index < str.length() ) {
-        query = str.substring( index + 1 );
-      }
-    }
-    if( query != null ) {
-      query = Base64.encodeBase64String( query.getBytes( "UTF-8" ) );
-      query = removeTrailingEquals( query );
-      url = Parser.parse( path + "?" + ENCODED_PARAMETER_NAME +"=" + query );
-      context.setCurrentUrl( url );
-    }
-    return UrlRewriteStepStatus.SUCCESS;
-  }
-
-  @Override
-  public void destroy() {
-  }
-
-  private static String removeTrailingEquals( String s ) {
-    int i = s.length()-1;
-    while( i > 0 && s.charAt( i ) == '=' ) {
-      i--;
-    }
-    return s.substring( 0, i+1 );
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncryptDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncryptDescriptor.java b/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncryptDescriptor.java
deleted file mode 100644
index 9f3d7b9..0000000
--- a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncryptDescriptor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.gateway.securequery;
-
-import org.apache.hadoop.gateway.filter.rewrite.ext.UrlRewriteActionDescriptor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteActionDescriptorBase;
-
-public class SecureQueryEncryptDescriptor
-    extends UrlRewriteActionDescriptorBase
-    implements UrlRewriteActionDescriptor {
-
-  static final String STEP_NAME = "encrypt-query";
-
-  public SecureQueryEncryptDescriptor() {
-    super( STEP_NAME );
-  }
-
-  @Override
-  public String getParam() {
-    return null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncryptProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncryptProcessor.java b/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncryptProcessor.java
deleted file mode 100644
index df75a1b..0000000
--- a/gateway-provider-secure-query/src/main/java/org/apache/hadoop/gateway/securequery/SecureQueryEncryptProcessor.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.gateway.securequery;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepStatus;
-import org.apache.hadoop.gateway.util.urltemplate.Parser;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-
-import java.io.UnsupportedEncodingException;
-import java.util.List;
-
-public class SecureQueryEncryptProcessor
-    implements UrlRewriteStepProcessor<SecureQueryEncryptDescriptor> {
-
-  private static final String ENCRYPTED_PARAMETER_NAME = "_";
-
-  private String clusterName;
-
-  @Override
-  public String getType() {
-    return SecureQueryEncryptDescriptor.STEP_NAME;
-  }
-
-  @Override
-  public void initialize( UrlRewriteEnvironment environment, SecureQueryEncryptDescriptor descriptor ) throws Exception {
-    List<String> values = environment.resolve( "cluster.name" );
-    if( values != null && values.size() > 0 ) {
-      this.clusterName = environment.resolve( "cluster.name" ).get( 0 );
-    }
-  }
-
-  @Override
-  public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
-    //TODO: Need some way to get a reference to the keystore service and the encryption key in particular.
-    Template url = context.getCurrentUrl();
-    String str = url.toString();
-    String path = str;
-    String query = null;
-    int index = str.indexOf( '?' );
-    if( index >= 0 ) {
-      path = str.substring( 0, index );
-      if( index < str.length() ) {
-        query = str.substring( index + 1 );
-      }
-    }
-    if( query != null ) {
-      query = encode( query );
-      url = Parser.parse( path + "?" + ENCRYPTED_PARAMETER_NAME +"=" + query );
-      context.setCurrentUrl( url );
-    }
-    return UrlRewriteStepStatus.SUCCESS;
-  }
-
-  @Override
-  public void destroy() {
-  }
-
-  private String encode( String string ) throws UnsupportedEncodingException {
-    string = Base64.encodeBase64String( string.getBytes( "UTF-8" ) );
-    string = removeTrailingEquals( string );
-    return string;
-  }
-
-  private static String removeTrailingEquals( String s ) {
-    int i = s.length()-1;
-    while( i > 0 && s.charAt( i ) == '=' ) {
-      i--;
-    }
-    return s.substring( 0, i+1 );
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor b/gateway-provider-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor
deleted file mode 100644
index 14ed327..0000000
--- a/gateway-provider-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.deploy.ProviderDeploymentContributor
+++ /dev/null
@@ -1,19 +0,0 @@
-##########################################################################
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##########################################################################
-
-org.apache.hadoop.gateway.securequery.SecureQueryDeploymentContributor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor b/gateway-provider-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor
deleted file mode 100644
index c5f9376..0000000
--- a/gateway-provider-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteStepDescriptor
+++ /dev/null
@@ -1,22 +0,0 @@
-##########################################################################
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##########################################################################
-
-org.apache.hadoop.gateway.securequery.SecureQueryEncodeDescriptor
-org.apache.hadoop.gateway.securequery.SecureQueryDecodeDescriptor
-org.apache.hadoop.gateway.securequery.SecureQueryEncryptDescriptor
-org.apache.hadoop.gateway.securequery.SecureQueryDecryptDescriptor

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor b/gateway-provider-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor
deleted file mode 100644
index f216d77..0000000
--- a/gateway-provider-secure-query/src/main/resources/META-INF/services/org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteStepProcessor
+++ /dev/null
@@ -1,22 +0,0 @@
-##########################################################################
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##########################################################################
-
-org.apache.hadoop.gateway.securequery.SecureQueryEncodeProcessor
-org.apache.hadoop.gateway.securequery.SecureQueryDecodeProcessor
-org.apache.hadoop.gateway.securequery.SecureQueryEncryptProcessor
-org.apache.hadoop.gateway.securequery.SecureQueryDecryptProcessor

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeDescriptorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeDescriptorTest.java b/gateway-provider-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeDescriptorTest.java
deleted file mode 100644
index cb496e8..0000000
--- a/gateway-provider-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeDescriptorTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.gateway.securequery;
-
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public class SecureQueryDecodeDescriptorTest {
-
-  @Test
-  public void testGetAndSet() {
-    SecureQueryDecodeDescriptor descriptor = new SecureQueryDecodeDescriptor();
-    assertThat( descriptor.type(), is( "decode-query" ) );
-    assertThat( descriptor.getParam(), nullValue() );
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2f135e16/gateway-provider-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeProcessorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeProcessorTest.java b/gateway-provider-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeProcessorTest.java
deleted file mode 100644
index e8af9ce..0000000
--- a/gateway-provider-secure-query/src/test/java/org/apache/hadoop/gateway/securequery/SecureQueryDecodeProcessorTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.gateway.securequery;
-
-import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteEnvironment;
-import org.apache.hadoop.gateway.filter.rewrite.spi.UrlRewriteContext;
-import org.apache.hadoop.gateway.util.urltemplate.Parser;
-import org.apache.hadoop.gateway.util.urltemplate.Template;
-import org.easymock.Capture;
-import org.easymock.EasyMock;
-import org.junit.Test;
-import sun.misc.BASE64Encoder;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public class SecureQueryDecodeProcessorTest {
-
-  @Test
-  public void testSimpleQueryDecode() throws Exception {
-    UrlRewriteEnvironment environment = new UrlRewriteEnvironment() {
-      @Override
-      public URL getResource( String name ) throws IOException {
-        return null;
-      }
-
-      @Override
-      public <T> T getAttribute( String name ) {
-        return null;
-      }
-
-      @Override
-      public List<String> resolve( String name ) {
-        return null;
-      }
-    };
-
-    BASE64Encoder encoder = new BASE64Encoder();
-    String encQuery = encoder.encode( "test-query".getBytes("utf-8" ) );
-    encQuery = encQuery.replaceAll( "\\=", "" );
-    String inString = "http://host:0/root/path?_=" + encQuery;
-    Template inTemplate = Parser.parse( inString );
-
-    UrlRewriteContext context = EasyMock.createNiceMock( UrlRewriteContext.class );
-    EasyMock.expect( context.getCurrentUrl() ).andReturn( inTemplate );
-    Capture<Template> outTemplate = new Capture<Template>();
-    context.setCurrentUrl( EasyMock.capture( outTemplate ) );
-    EasyMock.replay( context );
-
-    SecureQueryDecodeDescriptor descriptor = new SecureQueryDecodeDescriptor();
-    SecureQueryDecodeProcessor processor = new SecureQueryDecodeProcessor();
-    processor.initialize( environment, descriptor );
-    processor.process( context );
-
-    String outActual = outTemplate.getValue().toString();
-    assertThat( outActual, is( "http://host:0/root/path?test-query" ) );
-  }
-
-  @Test
-  public void testDecodeQueryWithNonEncodedParams() throws Exception {
-    UrlRewriteEnvironment environment = new UrlRewriteEnvironment() {
-      @Override
-      public URL getResource( String name ) throws IOException {
-        return null;
-      }
-
-      @Override
-      public <T> T getAttribute( String name ) {
-        return null;
-      }
-
-      @Override
-      public List<String> resolve( String name ) {
-        return null;
-      }
-    };
-
-    BASE64Encoder encoder = new BASE64Encoder();
-    String inQuery = "test-query=test-value";
-    String encQuery = encoder.encode( inQuery.getBytes( "utf-8" ) );
-    encQuery = encQuery.replaceAll( "\\=", "" );
-    String inString = "http://host:0/root/path?_=" + encQuery + "&clear-param=clear-value";
-    Template inTemplate = Parser.parse( inString );
-
-    UrlRewriteContext context = EasyMock.createNiceMock( UrlRewriteContext.class );
-    EasyMock.expect( context.getCurrentUrl() ).andReturn( inTemplate );
-    Capture<Template> outTemplate = new Capture<Template>();
-    context.setCurrentUrl( EasyMock.capture( outTemplate ) );
-    EasyMock.replay( context );
-
-    SecureQueryDecodeDescriptor descriptor = new SecureQueryDecodeDescriptor();
-    SecureQueryDecodeProcessor processor = new SecureQueryDecodeProcessor();
-    processor.initialize( environment, descriptor );
-    processor.process( context );
-
-    String outActual = outTemplate.getValue().toString();
-    assertThat( outActual, containsString( "http://host:0/root/path?" ) );
-    assertThat( outActual, containsString( "test-query=test-value" ) );
-    assertThat( outActual, containsString( "clear-param=clear-value" ) );
-    assertThat( outActual, not( containsString( encQuery ) ) );
-  }
-
-
-}