knox git commit: KNOX-1200 - Fixing maven assembly errors

2018-03-08 Thread coheigea
Repository: knox
Updated Branches:
  refs/heads/master 6f4555418 -> 8c919a4f4


KNOX-1200 - Fixing maven assembly errors


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/8c919a4f
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/8c919a4f
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/8c919a4f

Branch: refs/heads/master
Commit: 8c919a4f419517db7c43dffafc46ee7785302e37
Parents: 6f45554
Author: Colm O hEigeartaigh 
Authored: Thu Mar 8 15:33:25 2018 +
Committer: Colm O hEigeartaigh 
Committed: Thu Mar 8 15:33:25 2018 +

--
 gateway-release/pom.xml   | 1 +
 gateway-shell-release/pom.xml | 1 +
 pom.xml   | 1 +
 3 files changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/knox/blob/8c919a4f/gateway-release/pom.xml
--
diff --git a/gateway-release/pom.xml b/gateway-release/pom.xml
index f47c1ed..c729535 100644
--- a/gateway-release/pom.xml
+++ b/gateway-release/pom.xml
@@ -59,6 +59,7 @@
 
 
src/assembly.xml
 
+gnu
 
 
 

http://git-wip-us.apache.org/repos/asf/knox/blob/8c919a4f/gateway-shell-release/pom.xml
--
diff --git a/gateway-shell-release/pom.xml b/gateway-shell-release/pom.xml
index 92e8396..fd55864 100644
--- a/gateway-shell-release/pom.xml
+++ b/gateway-shell-release/pom.xml
@@ -82,6 +82,7 @@
 
 
src/assembly.xml
 
+gnu
 
 
 

http://git-wip-us.apache.org/repos/asf/knox/blob/8c919a4f/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 942cc6b..3297aa8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -190,6 +190,7 @@
 
 
src/assembly.xml
 
+gnu
 
 
 



knox git commit: KNOX-1190 - Compress cookies set by Pac4J, in some cases the cookie size exceeds 4K and cause them not to set.

2018-03-08 Thread more
Repository: knox
Updated Branches:
  refs/heads/master 9b5665be7 -> 6f4555418


KNOX-1190 - Compress cookies set by Pac4J, in some cases the cookie size 
exceeds 4K and cause them not to set.


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/6f455541
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/6f455541
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/6f455541

Branch: refs/heads/master
Commit: 6f45554182d122a39511a6d145d5f99b4cc19c50
Parents: 9b5665b
Author: Sandeep More 
Authored: Thu Mar 8 09:44:56 2018 -0500
Committer: Sandeep More 
Committed: Thu Mar 8 09:44:56 2018 -0500

--
 .../pac4j/filter/Pac4jDispatcherFilter.java | 18 -
 .../gateway/pac4j/session/KnoxSessionStore.java | 73 +---
 2 files changed, 82 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/knox/blob/6f455541/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jDispatcherFilter.java
--
diff --git 
a/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jDispatcherFilter.java
 
b/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jDispatcherFilter.java
index 0086228..46186f6 100644
--- 
a/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jDispatcherFilter.java
+++ 
b/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jDispatcherFilter.java
@@ -17,6 +17,7 @@
  */
 package org.apache.knox.gateway.pac4j.filter;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.knox.gateway.i18n.messages.MessagesFactory;
 import org.apache.knox.gateway.pac4j.Pac4jMessages;
 import org.apache.knox.gateway.pac4j.session.KnoxSessionStore;
@@ -29,6 +30,8 @@ import 
org.apache.knox.gateway.services.security.CryptoService;
 import org.pac4j.config.client.PropertiesConfigFactory;
 import org.pac4j.core.client.Client;
 import org.pac4j.core.config.Config;
+import org.pac4j.core.context.session.J2ESessionStore;
+import org.pac4j.core.context.session.SessionStore;
 import org.pac4j.core.util.CommonHelper;
 import org.pac4j.http.client.indirect.IndirectBasicAuthClient;
 import 
org.pac4j.http.credentials.authenticator.test.SimpleTestUsernamePasswordAuthenticator;
@@ -71,6 +74,8 @@ public class Pac4jDispatcherFilter implements Filter {
 
   private static final String PAC4J_CONFIG = "pac4j.config";
 
+  private static final String PAC4J_SESSION_STORE = "pac4j.session.store";
+
   private CallbackFilter callbackFilter;
 
   private SecurityFilter securityFilter;
@@ -160,7 +165,18 @@ public class Pac4jDispatcherFilter implements Filter {
 securityFilter.setConfigOnly(config);
 
 final String domainSuffix = 
filterConfig.getInitParameter(PAC4J_COOKIE_DOMAIN_SUFFIX_PARAM);
-config.setSessionStore(new KnoxSessionStore(cryptoService, clusterName, 
domainSuffix));
+final String sessionStoreVar = 
filterConfig.getInitParameter(PAC4J_SESSION_STORE);
+
+SessionStore sessionStore;
+
+if(!StringUtils.isBlank(sessionStoreVar) && 
J2ESessionStore.class.getName().contains(sessionStoreVar) ) {
+  sessionStore = new J2ESessionStore();
+} else {
+  sessionStore = new KnoxSessionStore(cryptoService, clusterName, 
domainSuffix);
+}
+
+config.setSessionStore(sessionStore);
+
   }
 
   private void addDefaultConfig(String clientNameParameter, Map properties) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6f455541/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/session/KnoxSessionStore.java
--
diff --git 
a/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/session/KnoxSessionStore.java
 
b/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/session/KnoxSessionStore.java
index 4ba55ea..0eb5322 100644
--- 
a/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/session/KnoxSessionStore.java
+++ 
b/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/session/KnoxSessionStore.java
@@ -18,6 +18,7 @@
 package org.apache.knox.gateway.pac4j.session;
 
 import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.io.IOUtils;
 import org.apache.knox.gateway.services.security.CryptoService;
 import org.apache.knox.gateway.services.security.EncryptionResult;
 import org.apache.knox.gateway.util.Urls;
@@ -30,8 +31,13 @@ import org.pac4j.core.util.JavaSerializationHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.ByteArrayInputStream;
+import 

knox git commit: KNOX-1201 - Disable DocTypes

2018-03-08 Thread coheigea
Repository: knox
Updated Branches:
  refs/heads/master 5f9ee5a08 -> 9b5665be7


KNOX-1201 - Disable DocTypes


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/9b5665be
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/9b5665be
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/9b5665be

Branch: refs/heads/master
Commit: 9b5665be7016f3a574702d0ac843e9e677214dc5
Parents: 5f9ee5a
Author: Colm O hEigeartaigh 
Authored: Thu Mar 8 11:01:58 2018 +
Committer: Colm O hEigeartaigh 
Committed: Thu Mar 8 11:01:58 2018 +

--
 .../src/main/java/org/apache/knox/gateway/util/XmlUtils.java  | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/knox/blob/9b5665be/gateway-util-common/src/main/java/org/apache/knox/gateway/util/XmlUtils.java
--
diff --git 
a/gateway-util-common/src/main/java/org/apache/knox/gateway/util/XmlUtils.java 
b/gateway-util-common/src/main/java/org/apache/knox/gateway/util/XmlUtils.java
index fc21d4e..b3494fe 100644
--- 
a/gateway-util-common/src/main/java/org/apache/knox/gateway/util/XmlUtils.java
+++ 
b/gateway-util-common/src/main/java/org/apache/knox/gateway/util/XmlUtils.java
@@ -46,6 +46,7 @@ public class XmlUtils {
   public static Document readXml( InputStream input ) throws 
ParserConfigurationException, IOException, SAXException {
 DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
 f.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+f.setFeature("http://apache.org/xml/features/disallow-doctype-decl;, true);
 DocumentBuilder b = f.newDocumentBuilder();
 return b.parse( input );
   }
@@ -53,6 +54,7 @@ public class XmlUtils {
   public static Document readXml( InputSource source ) throws 
ParserConfigurationException, IOException, SAXException {
 DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
 f.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+f.setFeature("http://apache.org/xml/features/disallow-doctype-decl;, true);
 DocumentBuilder b = f.newDocumentBuilder();
 return b.parse( source );
   }
@@ -98,6 +100,7 @@ public class XmlUtils {
   public static Document createDocument(boolean standalone) throws 
ParserConfigurationException {
 DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
 f.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+f.setFeature("http://apache.org/xml/features/disallow-doctype-decl;, true);
 DocumentBuilder b = f.newDocumentBuilder();
 Document d = b.newDocument();
 d.setXmlStandalone( standalone );