knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [knox] branch master updated: KNOX-2122 - Use static base class constants
Date Sun, 17 Nov 2019 18:10:30 GMT
This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new 40f699f  KNOX-2122 - Use static base class constants
40f699f is described below

commit 40f699fa3acebf8671aa4050418c00261d39c5b3
Author: Kevin Risden <krisden@apache.org>
AuthorDate: Sun Nov 17 13:10:15 2019 -0500

    KNOX-2122 - Use static base class constants
    
    Signed-off-by: Kevin Risden <krisden@apache.org>
---
 .../filter/rewrite/impl/xml/XmlFilterReader.java   | 33 +++++++++++-----------
 .../pac4j/filter/Pac4jDispatcherFilter.java        |  7 +++--
 2 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReader.java
b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReader.java
index 1944d7e..1b6846e 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReader.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReader.java
@@ -39,6 +39,7 @@ import javax.xml.namespace.QName;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.events.Attribute;
 import javax.xml.stream.events.Characters;
@@ -147,37 +148,37 @@ public abstract class XmlFilterReader extends Reader {
   private void processEvent( XMLEvent event ) throws ParserConfigurationException, XPathExpressionException,
IOException, XMLStreamException {
     int type = event.getEventType();
     switch( type ) {
-      case XMLEvent.START_DOCUMENT:
+      case XMLStreamConstants.START_DOCUMENT:
         processStartDocument( (StartDocument)event );
         break;
-      case XMLEvent.END_DOCUMENT:
+      case XMLStreamConstants.END_DOCUMENT:
         processEndDocument();
         break;
-      case XMLEvent.START_ELEMENT:
-        if( parser.peek().getEventType() == XMLEvent.END_ELEMENT ) {
+      case XMLStreamConstants.START_ELEMENT:
+        if( parser.peek().getEventType() == XMLStreamConstants.END_ELEMENT ) {
           isEmptyElement = true;
         }
         processStartElement( event.asStartElement());
         break;
-      case XMLEvent.END_ELEMENT:
+      case XMLStreamConstants.END_ELEMENT:
         processEndElement( event.asEndElement() );
         isEmptyElement = false;
         break;
-      case XMLEvent.CHARACTERS:
-      case XMLEvent.CDATA:
-      case XMLEvent.SPACE:
+      case XMLStreamConstants.CHARACTERS:
+      case XMLStreamConstants.CDATA:
+      case XMLStreamConstants.SPACE:
         processCharacters( event.asCharacters() );
         break;
-      case XMLEvent.COMMENT:
+      case XMLStreamConstants.COMMENT:
         processComment( (Comment)event );
         break;
-      case XMLEvent.DTD:
-      case XMLEvent.NAMESPACE:
-      case XMLEvent.ATTRIBUTE:
-      case XMLEvent.ENTITY_REFERENCE:
-      case XMLEvent.ENTITY_DECLARATION:
-      case XMLEvent.NOTATION_DECLARATION:
-      case XMLEvent.PROCESSING_INSTRUCTION:
+      case XMLStreamConstants.DTD:
+      case XMLStreamConstants.NAMESPACE:
+      case XMLStreamConstants.ATTRIBUTE:
+      case XMLStreamConstants.ENTITY_REFERENCE:
+      case XMLStreamConstants.ENTITY_DECLARATION:
+      case XMLStreamConstants.NOTATION_DECLARATION:
+      case XMLStreamConstants.PROCESSING_INSTRUCTION:
       default:
         // Fail if we run into any of these for now.
         throw new IllegalStateException( Integer.toString( type ) );
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 8b51521..4eaabaa 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
@@ -29,6 +29,7 @@ import org.apache.knox.gateway.services.security.CryptoService;
 import org.apache.knox.gateway.services.security.KeystoreService;
 import org.apache.knox.gateway.services.security.MasterService;
 import org.pac4j.config.client.PropertiesConfigFactory;
+import org.pac4j.config.client.PropertiesConstants;
 import org.pac4j.core.client.Client;
 import org.pac4j.core.config.Config;
 import org.pac4j.core.context.session.J2ESessionStore;
@@ -221,7 +222,7 @@ public class Pac4jDispatcherFilter implements Filter {
   private void addDefaultConfig(String clientNameParameter, Map<String, String> properties)
{
     // add default saml params
     if (clientNameParameter.contains(SAML2Client.class.getSimpleName())) {
-      properties.put(PropertiesConfigFactory.SAML_KEYSTORE_PATH,
+      properties.put(PropertiesConstants.SAML_KEYSTORE_PATH,
           keystoreService.getKeystorePath());
 
       // check for provisioned alias for keystore password
@@ -235,7 +236,7 @@ public class Pac4jDispatcherFilter implements Filter {
         // no alias provisioned then use the master
         giksp = masterService.getMasterSecret();
       }
-      properties.put(PropertiesConfigFactory.SAML_KEYSTORE_PASSWORD, new String(giksp));
+      properties.put(PropertiesConstants.SAML_KEYSTORE_PASSWORD, new String(giksp));
 
       // check for provisioned alias for private key
       char[] gip = null;
@@ -249,7 +250,7 @@ public class Pac4jDispatcherFilter implements Filter {
         // no alias provisioned then use the master
         gip = masterService.getMasterSecret();
       }
-      properties.put(PropertiesConfigFactory.SAML_PRIVATE_KEY_PASSWORD, new String(gip));
+      properties.put(PropertiesConstants.SAML_PRIVATE_KEY_PASSWORD, new String(gip));
     }
   }
 


Mime
View raw message