You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2019/06/26 21:53:53 UTC

[cxf-fediz] branch master updated: Update maven-checkstyle-plugin and maven-pmd-plugin

This is an automated email from the ASF dual-hosted git repository.

buhhunyx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git


The following commit(s) were added to refs/heads/master by this push:
     new a3b374a  Update maven-checkstyle-plugin and maven-pmd-plugin
a3b374a is described below

commit a3b374a54cbf45d6f475b3c3ba531b794b6b1a62
Author: Alexey Markevich <bu...@gmail.com>
AuthorDate: Thu Jun 27 00:53:04 2019 +0300

    Update maven-checkstyle-plugin and maven-pmd-plugin
---
 .../cxf/fediz/core/config/FedizConfigurator.java   |   2 +-
 .../cxf/fediz/core/handler/LogoutHandler.java      |   9 +-
 .../core/metadata/MetadataDocumentHandler.java     |   8 +-
 .../core/processor/FederationProcessorImpl.java    |   6 +-
 .../fediz/core/processor/SAMLProcessorImpl.java    |  10 +-
 .../org/apache/cxf/fediz/core/saml/SAMLUtil.java   |   3 +-
 .../fediz/core/AbstractSAMLCallbackHandler.java    |   4 +-
 .../cxf/fediz/core/config/CallbackHandlerTest.java |   1 +
 .../fediz/core/config/FedizConfigurationTest.java  |   1 +
 .../core/config/FedizConfigurationWriterTest.java  |   1 +
 .../core/federation/AudienceRestrictionTest.java   |   1 +
 .../fediz/core/federation/ClaimsProcessorTest.java |   1 +
 .../cxf/fediz/core/federation/CustomValidator.java |   1 +
 .../core/federation/FederationLogoutTest.java      |   1 +
 .../core/federation/FederationMetaDataTest.java    |   1 +
 .../core/federation/FederationRequestTest.java     |   1 +
 .../core/federation/FederationResponseTest.java    |   2 +
 .../fediz/core/federation/RequestedClaimsTest.java |   1 +
 .../core/federation/SAMLTokenValidatorOldTest.java |   2 +
 .../cxf/fediz/core/samlsso/CustomValidator.java    |   1 +
 .../samlsso/SAML2PResponseComponentBuilder.java    |   4 +-
 .../cxf/fediz/core/samlsso/SAMLLogoutTest.java     |  22 +-
 .../cxf/fediz/core/samlsso/SAMLMetaDataTest.java   |   2 +
 .../cxf/fediz/core/samlsso/SAMLRequestTest.java    |   5 +-
 .../core/samlsso/SAMLResponseConformanceTest.java  |   9 +-
 .../cxf/fediz/core/samlsso/SAMLResponseTest.java   |  13 +-
 .../cxf/plugin/FedizRedirectBindingFilter.java     |   2 +-
 .../cxf/fediz/jetty9/FederationAuthenticator.java  |   4 +-
 .../FederationAuthenticationProvider.java          |   6 +-
 .../FederationAuthenticationToken.java             |   7 +-
 ...tedAuthoritiesUserDetailsFederationService.java |   3 +-
 .../web/FederationAuthenticationEntryPoint.java    |   3 +-
 .../spring/web/FederationAuthenticationFilter.java |   5 +-
 pom.xml                                            |  17 +-
 .../cxf/fediz/service/idp/FedizEntryPoint.java     |   7 +-
 .../service/idp/STSKrbAuthenticationProvider.java  |   3 +-
 .../cxf/fediz/service/idp/STSPortFilter.java       |   3 +-
 .../idp/STSPreAuthAuthenticationProvider.java      |   3 +-
 .../service/idp/STSUPAuthenticationProvider.java   |   3 +-
 .../fediz/service/idp/beans/STSClientAction.java   |   4 +-
 .../beans/samlsso/AbstractSamlResponseCreator.java |   4 +-
 .../idp/beans/samlsso/LocalRedirectCreator.java    |   8 +-
 .../AbstractTrustedIdpOAuth2ProtocolHandler.java   |  27 +-
 .../protocols/TrustedIdpSAMLProtocolHandler.java   |   2 +-
 .../protocols/TrustedIdpWSFedProtocolHandler.java  |  12 +-
 .../service/idp/service/jpa/DBLoaderSpring.java    |   9 +-
 .../service/idp/beans/STSClientActionTest.java     |   4 +-
 .../idp/service/jpa/ApplicationDAOJPATest.java     |   9 +-
 .../service/idp/service/jpa/ClaimDAOJPATest.java   |   9 +-
 .../idp/service/jpa/EntitlementDAOJPATest.java     |   9 +-
 .../service/idp/service/jpa/IdpDAOJPATest.java     |   9 +-
 .../idp/service/jpa/TrustedIdpDAOJPATest.java      |  10 +-
 .../fediz/service/idp/util/MetadataWriterTest.java |   6 +-
 .../service/idp/integrationtests/RestITTest.java   |   1 +
 .../fediz/service/oidc/FedizSubjectCreator.java    |   3 +-
 .../fediz/service/sts/realms/SamlRealmCodec.java   |   2 +-
 .../fediz/service/sts/realms/UriRealmParser.java   |   2 +-
 .../org/apache/cxf/fediz/sts/AbstractSTSTest.java  |   5 +-
 .../cxf/fediz/sts/realms/ITCrossRealmTest.java     |   3 +-
 .../realms/RealmExtensionIdentityMapperTest.java   |   1 +
 .../systests/custom/CustomParametersTest.java      |   6 +-
 .../cxf/fediz/systests/cxf/FederationTest.java     |  17 +-
 .../cxf/fediz/systests/cxf/TokenExpiryTest.java    |   1 +
 .../systests/federation/samlsso/SAMLSSOTest.java   |   1 +
 .../systests/federation/unknown/WSFedTest.java     |   1 +
 .../fediz/systests/federation/wsfed/WSFedTest.java |  51 +-
 .../org/apache/cxf/fediz/systests/idp/IdpTest.java |   1 +
 .../jetty9/ClientCertificatePreAuthSpringTest.java |   1 +
 .../systests/jetty9/ClientCertificateTest.java     |   1 +
 .../systests/jetty9/JettyPreAuthSpringTest.java    |   1 +
 .../cxf/fediz/systests/jetty9/JettyTest.java       |   1 +
 .../cxf/fediz/systests/jetty9/TokenExpiryTest.java |   1 +
 .../cxf/fediz/systests/kerberos/KerberosTest.java  |   1 +
 .../apache/cxf/fediz/systests/ldap/LDAPTest.java   |   7 +-
 .../cxf/fediz/systests/oidc/AbstractOIDCTest.java  |  61 +-
 .../apache/cxf/fediz/systests/samlsso/CXFTest.java |  36 +-
 .../apache/cxf/fediz/systests/samlsso/IdpTest.java | 631 +++++++--------------
 .../cxf/fediz/systests/samlsso/JettyTest.java      |  17 +-
 .../cxf/fediz/systests/samlsso/SpringTest.java     |  38 +-
 ...omcat8PluginTest.java => TomcatPluginTest.java} |  49 +-
 .../cxf/fediz/systests/spring/SpringTest.java      |  20 +-
 .../cxf/fediz/systests/spring/TokenExpiryTest.java |   1 +
 .../systests/common/AbstractClientCertTests.java   |   1 +
 .../fediz/systests/common/AbstractExpiryTests.java |   7 +-
 .../cxf/fediz/systests/common/AbstractTests.java   |   1 +
 .../cxf/fediz/systests/common/HTTPTestUtils.java   |   5 +-
 .../systests/tomcat/AudienceRestrictionTest.java   |  13 +-
 .../systests/tomcat/ClientCertificateTest.java     |   1 +
 .../cxf/fediz/systests/tomcat/HolderOfKeyTest.java |  15 +-
 .../cxf/fediz/systests/tomcat/TokenExpiryTest.java |   1 +
 .../cxf/fediz/systests/tomcat/TomcatLauncher.java  |  24 +-
 .../cxf/fediz/systests/tomcat/TomcatTest.java      |  17 +-
 .../apache/cxf/fediz/systests/tomcat/WReqTest.java |  15 +-
 .../java/org/apache/cxf/fediz/example/Service.java |  22 +-
 94 files changed, 591 insertions(+), 792 deletions(-)

diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FedizConfigurator.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FedizConfigurator.java
index e4a61c1..20d41d0 100644
--- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FedizConfigurator.java
+++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FedizConfigurator.java
@@ -104,7 +104,7 @@ public class FedizConfigurator {
         return null;
     }
 
-    public ContextConfig getContextConfig(String contextName) throws IllegalArgumentException {
+    public ContextConfig getContextConfig(String contextName) {
         if (contextName == null) {
             throw new IllegalArgumentException("Context Name cannot be 'null'.");
         }
diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/handler/LogoutHandler.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/handler/LogoutHandler.java
index c7ee9aa..80a4c96 100644
--- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/handler/LogoutHandler.java
+++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/handler/LogoutHandler.java
@@ -207,21 +207,14 @@ public class LogoutHandler implements RequestHandler<Boolean> {
         }
         int read = 0;
         byte[] buf = new byte[1024];
-        try {
+        try (ServletOutputStream responseOutputStream = response.getOutputStream()) {
             response.setContentType("image/jpeg");
-            ServletOutputStream responseOutputStream = response.getOutputStream();
             while ((read = inputStream.read(buf)) != -1) {
                 responseOutputStream.write(buf, 0, read);
             }
             responseOutputStream.flush();
         } catch (IOException e) {
             LOG.error("Could not send logout image: {}", e.getMessage());
-        } finally {
-            try {
-                inputStream.close();
-            } catch (IOException e) {
-                // ignore
-            }
         }
     }
 
diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/metadata/MetadataDocumentHandler.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/metadata/MetadataDocumentHandler.java
index 32d366f..655fad7 100644
--- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/metadata/MetadataDocumentHandler.java
+++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/metadata/MetadataDocumentHandler.java
@@ -67,9 +67,7 @@ public class MetadataDocumentHandler implements RequestHandler<Boolean> {
     public Boolean handleRequest(HttpServletRequest request, HttpServletResponse response) {
         LOG.debug("Metadata document requested");
         FedizProcessor wfProc = FedizProcessorFactory.newFedizProcessor(fedizConfig.getProtocol());
-        PrintWriter out = null;
-        try {
-            out = response.getWriter();
+        try (PrintWriter out = response.getWriter()) {
             Document metadata = wfProc.getMetaData(request, fedizConfig);
             out.write(DOM2Writer.nodeToString(metadata));
             response.setContentType("text/xml");
@@ -82,10 +80,6 @@ public class MetadataDocumentHandler implements RequestHandler<Boolean> {
                 LOG.error("Failed to send error response: {}", e.getMessage());
             }
             return false;
-        } finally {
-            if (out != null) {
-                out.close();
-            }
         }
     }
 }
diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FederationProcessorImpl.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FederationProcessorImpl.java
index 55ffce1..fafde08 100644
--- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FederationProcessorImpl.java
+++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FederationProcessorImpl.java
@@ -386,7 +386,7 @@ public class FederationProcessorImpl extends AbstractFedizProcessor {
             StringBuffer requestURL = request.getRequestURL();
             String params = request.getQueryString();
             if (params != null && !params.isEmpty()) {
-                requestURL.append("?").append(params);
+                requestURL.append('?').append(params);
             }
 
             requestState = new RequestState();
@@ -577,7 +577,7 @@ public class FederationProcessorImpl extends AbstractFedizProcessor {
                     StringBuilder sbQuery = new StringBuilder();
                     for (Entry<String, String> entry : signInQueryMap.entrySet()) {
                         if (sbQuery.length() > 0) {
-                            sbQuery.append("&");
+                            sbQuery.append('&');
                         }
                         sbQuery.append(entry.getKey()).append('=').append(URLEncoder.encode(entry.getValue(), "UTF-8"));
                     }
@@ -621,7 +621,7 @@ public class FederationProcessorImpl extends AbstractFedizProcessor {
                     StringBuilder sbQuery = new StringBuilder();
                     for (Entry<String, String> entry : signOutQueryMap.entrySet()) {
                         if (sbQuery.length() > 0) {
-                            sbQuery.append("&");
+                            sbQuery.append('&');
                         }
                         sbQuery.append(entry.getKey()).append('=').append(URLEncoder.encode(entry.getValue(), "UTF-8"));
                     }
diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/SAMLProcessorImpl.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/SAMLProcessorImpl.java
index 25ef3f7..64de1ac 100644
--- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/SAMLProcessorImpl.java
+++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/SAMLProcessorImpl.java
@@ -437,11 +437,11 @@ public class SAMLProcessorImpl extends AbstractFedizProcessor {
 
             StringBuilder sb = new StringBuilder();
             sb.append(SAMLSSOConstants.SAML_REQUEST).append('=').append(urlEncodedRequest);
-            sb.append("&" + SAMLSSOConstants.RELAY_STATE).append('=').append(relayState);
+            sb.append('&').append(SAMLSSOConstants.RELAY_STATE).append('=').append(relayState);
 
             if (((SAMLProtocol)config.getProtocol()).isSignRequest()) {
                 String signature = signRequest(config, sb);
-                sb.append("&" + SAMLSSOConstants.SIGNATURE).append('=').append(signature);
+                sb.append('&').append(SAMLSSOConstants.SIGNATURE).append('=').append(signature);
             }
 
             RedirectionResponse response = new RedirectionResponse();
@@ -502,7 +502,7 @@ public class SAMLProcessorImpl extends AbstractFedizProcessor {
         Signature signature = Signature.getInstance(jceSigAlgo);
         signature.initSign(privateKey);
 
-        sb.append("&" + SAMLSSOConstants.SIG_ALG).append('=').append(URLEncoder.encode(sigAlgo, "UTF-8"));
+        sb.append('&').append(SAMLSSOConstants.SIG_ALG).append('=').append(URLEncoder.encode(sigAlgo, "UTF-8"));
         String requestToSign = sb.toString();
 
         signature.update(requestToSign.getBytes(StandardCharsets.UTF_8));
@@ -580,11 +580,11 @@ public class SAMLProcessorImpl extends AbstractFedizProcessor {
 
             StringBuilder sb = new StringBuilder();
             sb.append(SAMLSSOConstants.SAML_REQUEST).append('=').append(urlEncodedRequest);
-            sb.append("&" + SAMLSSOConstants.RELAY_STATE).append('=').append(relayState);
+            sb.append('&').append(SAMLSSOConstants.RELAY_STATE).append('=').append(relayState);
 
             if (((SAMLProtocol)config.getProtocol()).isSignRequest()) {
                 String signature = signRequest(config, sb);
-                sb.append("&" + SAMLSSOConstants.SIGNATURE).append('=').append(signature);
+                sb.append('&').append(SAMLSSOConstants.SIGNATURE).append('=').append(signature);
             }
 
             RedirectionResponse response = new RedirectionResponse();
diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLUtil.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLUtil.java
index d7609d9..85f21af 100644
--- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLUtil.java
+++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLUtil.java
@@ -83,8 +83,7 @@ public final class SAMLUtil  {
         if (subjectCerts != null && subjectCerts.length > 0
             && tlsCerts[0].equals(subjectCerts[0])) {
             return true;
-        } else if (subjectPublicKey != null
-            && tlsCerts[0].getPublicKey().equals(subjectPublicKey)) {
+        } else if (tlsCerts[0].getPublicKey().equals(subjectPublicKey)) {
             return true;
         }
 
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/AbstractSAMLCallbackHandler.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/AbstractSAMLCallbackHandler.java
index 2f67522..7fc9ece 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/AbstractSAMLCallbackHandler.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/AbstractSAMLCallbackHandler.java
@@ -442,12 +442,12 @@ public abstract class AbstractSAMLCallbackHandler implements CallbackHandler {
     }
 
     protected String getNamespaceOfClaimType(String claimType) {
-        int i = claimType.lastIndexOf("/");
+        int i = claimType.lastIndexOf('/');
         return claimType.substring(0, i);
     }
 
     protected String getNameOfClaimType(String claimType) {
-        int i = claimType.lastIndexOf("/");
+        int i = claimType.lastIndexOf('/');
         return claimType.substring(i + 1);
     }
 
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/CallbackHandlerTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/CallbackHandlerTest.java
index 58267c8..fbc66dd 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/CallbackHandlerTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/CallbackHandlerTest.java
@@ -53,6 +53,7 @@ import org.apache.cxf.fediz.core.spi.ReplyCallback;
 import org.apache.cxf.fediz.core.spi.SignInQueryCallback;
 import org.apache.cxf.fediz.core.spi.WAuthCallback;
 import org.apache.cxf.fediz.core.spi.WReqCallback;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/FedizConfigurationTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/FedizConfigurationTest.java
index a09753e..9fbaa06 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/FedizConfigurationTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/FedizConfigurationTest.java
@@ -53,6 +53,7 @@ import org.apache.cxf.fediz.core.processor.ClaimsProcessor;
 import org.apache.wss4j.common.cache.EHCacheReplayCache;
 import org.apache.wss4j.common.cache.MemoryReplayCache;
 import org.apache.wss4j.common.cache.ReplayCache;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/FedizConfigurationWriterTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/FedizConfigurationWriterTest.java
index d4d4bf3..cb58585 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/FedizConfigurationWriterTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/FedizConfigurationWriterTest.java
@@ -48,6 +48,7 @@ import org.apache.cxf.fediz.core.config.jaxb.TrustManagersType;
 import org.apache.cxf.fediz.core.config.jaxb.TrustedIssuerType;
 import org.apache.cxf.fediz.core.config.jaxb.TrustedIssuers;
 import org.apache.cxf.fediz.core.config.jaxb.ValidationType;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/AudienceRestrictionTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/AudienceRestrictionTest.java
index 0f1fdf6..0339720 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/AudienceRestrictionTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/AudienceRestrictionTest.java
@@ -51,6 +51,7 @@ import org.apache.wss4j.common.saml.bean.ConditionsBean;
 import org.apache.wss4j.common.saml.builder.SAML2Constants;
 import org.apache.wss4j.common.util.DOM2Writer;
 import org.apache.wss4j.common.util.XMLUtils;
+
 import org.easymock.EasyMock;
 import org.junit.AfterClass;
 import org.junit.Assert;
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/ClaimsProcessorTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/ClaimsProcessorTest.java
index 1d08b4c..5c33b29 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/ClaimsProcessorTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/ClaimsProcessorTest.java
@@ -74,6 +74,7 @@ import org.apache.wss4j.common.saml.bean.ConditionsBean;
 import org.apache.wss4j.common.saml.builder.SAML2Constants;
 import org.apache.wss4j.common.util.DOM2Writer;
 import org.apache.wss4j.common.util.XMLUtils;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/CustomValidator.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/CustomValidator.java
index 3f62983..89d6d84 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/CustomValidator.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/CustomValidator.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.fediz.core.federation;
 
 import org.w3c.dom.Element;
+
 import org.apache.cxf.fediz.core.TokenValidator;
 import org.apache.cxf.fediz.core.TokenValidatorRequest;
 import org.apache.cxf.fediz.core.TokenValidatorResponse;
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationLogoutTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationLogoutTest.java
index 4f10ebe..c4af4ba 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationLogoutTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationLogoutTest.java
@@ -34,6 +34,7 @@ import org.apache.cxf.fediz.core.FederationConstants;
 import org.apache.cxf.fediz.core.config.FedizConfigurator;
 import org.apache.cxf.fediz.core.config.FedizContext;
 import org.apache.cxf.fediz.core.handler.LogoutHandler;
+
 import org.easymock.EasyMock;
 import org.junit.AfterClass;
 import org.junit.Assert;
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationMetaDataTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationMetaDataTest.java
index bfcdc9a..0414e0c 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationMetaDataTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationMetaDataTest.java
@@ -40,6 +40,7 @@ import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.signature.XMLSignature;
 import org.apache.xml.security.signature.XMLSignatureException;
+
 import org.easymock.EasyMock;
 import org.junit.AfterClass;
 import org.junit.Assert;
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationRequestTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationRequestTest.java
index 3f22e24..f27c7d4 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationRequestTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationRequestTest.java
@@ -33,6 +33,7 @@ import org.apache.cxf.fediz.core.config.FedizContext;
 import org.apache.cxf.fediz.core.processor.FederationProcessorImpl;
 import org.apache.cxf.fediz.core.processor.FedizProcessor;
 import org.apache.cxf.fediz.core.processor.RedirectionResponse;
+
 import org.easymock.EasyMock;
 import org.junit.AfterClass;
 import org.junit.Assert;
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java
index 77f6b79..b013ac6 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java
@@ -33,6 +33,7 @@ import javax.security.auth.callback.UnsupportedCallbackException;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+
 import org.apache.cxf.fediz.common.STSUtil;
 import org.apache.cxf.fediz.common.SecurityTestUtil;
 import org.apache.cxf.fediz.core.AbstractSAMLCallbackHandler;
@@ -81,6 +82,7 @@ import org.apache.wss4j.dom.WSConstants;
 import org.apache.wss4j.dom.message.WSSecEncrypt;
 import org.joda.time.DateTime;
 import org.joda.time.DateTimeZone;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/RequestedClaimsTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/RequestedClaimsTest.java
index 177ebdf..95c4b54 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/RequestedClaimsTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/RequestedClaimsTest.java
@@ -74,6 +74,7 @@ import org.apache.wss4j.common.saml.bean.ConditionsBean;
 import org.apache.wss4j.common.saml.builder.SAML2Constants;
 import org.apache.wss4j.common.util.DOM2Writer;
 import org.apache.wss4j.common.util.XMLUtils;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/SAMLTokenValidatorOldTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/SAMLTokenValidatorOldTest.java
index b5baa6b..f9cca94 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/SAMLTokenValidatorOldTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/SAMLTokenValidatorOldTest.java
@@ -30,6 +30,7 @@ import javax.security.auth.callback.UnsupportedCallbackException;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+
 import org.apache.cxf.fediz.common.STSUtil;
 import org.apache.cxf.fediz.common.SecurityTestUtil;
 import org.apache.cxf.fediz.core.AbstractSAMLCallbackHandler;
@@ -58,6 +59,7 @@ import org.apache.wss4j.common.saml.builder.SAML1Constants;
 import org.apache.wss4j.common.saml.builder.SAML2Constants;
 import org.apache.wss4j.common.util.DOM2Writer;
 import org.apache.wss4j.common.util.XMLUtils;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/CustomValidator.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/CustomValidator.java
index baa4c58..69665da 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/CustomValidator.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/CustomValidator.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.fediz.core.samlsso;
 
 import org.w3c.dom.Element;
+
 import org.apache.cxf.fediz.core.TokenValidator;
 import org.apache.cxf.fediz.core.TokenValidatorRequest;
 import org.apache.cxf.fediz.core.TokenValidatorResponse;
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAML2PResponseComponentBuilder.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAML2PResponseComponentBuilder.java
index 6c397cf..5735a76 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAML2PResponseComponentBuilder.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAML2PResponseComponentBuilder.java
@@ -86,13 +86,13 @@ public final class SAML2PResponseComponentBuilder {
 
         return response;
     }
-    
+
     public static LogoutResponse createSAMLLogoutResponse(
         String inResponseTo,
         String issuer,
         Status status,
         String destination
-        ) {
+    ) {
         if (logoutResponseBuilder == null) {
             logoutResponseBuilder = (SAMLObjectBuilder<LogoutResponse>)
                 builderFactory.getBuilder(LogoutResponse.DEFAULT_ELEMENT_NAME);
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLLogoutTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLLogoutTest.java
index abd3c5f..d7ae516 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLLogoutTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLLogoutTest.java
@@ -35,6 +35,9 @@ import javax.servlet.http.HttpServletResponse;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
 import org.apache.cxf.fediz.common.SecurityTestUtil;
 import org.apache.cxf.fediz.core.KeystoreCallbackHandler;
 import org.apache.cxf.fediz.core.config.FedizConfigurator;
@@ -47,10 +50,6 @@ import org.apache.wss4j.common.ext.WSPasswordCallback;
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.common.saml.OpenSAMLUtil;
 import org.apache.wss4j.common.util.DOM2Writer;
-import org.easymock.EasyMock;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
 import org.opensaml.saml.common.SAMLObjectContentReference;
 import org.opensaml.saml.common.SignableSAMLObject;
 import org.opensaml.saml.saml2.core.LogoutResponse;
@@ -60,18 +59,21 @@ import org.opensaml.xmlsec.keyinfo.impl.X509KeyInfoGeneratorFactory;
 import org.opensaml.xmlsec.signature.KeyInfo;
 import org.opensaml.xmlsec.signature.Signature;
 import org.opensaml.xmlsec.signature.support.SignatureConstants;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
+
+import org.easymock.EasyMock;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
 
 /**
  * Some tests for logout for SAML SSO
  */
 public class SAMLLogoutTest {
-    private static final String LOGOUT_URL = "https://localhost/fedizhelloworld/secure/logout";
-    private static final String LOGOUT_URI = "/secure/logout";
     static final String TEST_REQUEST_URL = "https://localhost/fedizhelloworld/";
     static final String TEST_IDP_ISSUER = "http://url_to_the_issuer";
     static final String TEST_CLIENT_ADDRESS = "https://127.0.0.1";
+    private static final String LOGOUT_URL = "https://localhost/fedizhelloworld/secure/logout";
+    private static final String LOGOUT_URI = "/secure/logout";
 
     private static final String CONFIG_FILE = "fediz_test_config_saml.xml";
 
@@ -272,9 +274,9 @@ public class SAMLLogoutTest {
 
         String sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1;
         String pubKeyAlgo = issuerCerts[0].getPublicKey().getAlgorithm();
-        if (pubKeyAlgo.equalsIgnoreCase("DSA")) {
+        if ("DSA".equalsIgnoreCase(pubKeyAlgo)) {
             sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_DSA;
-        } else if (pubKeyAlgo.equalsIgnoreCase("EC")) {
+        } else if ("EC".equalsIgnoreCase(pubKeyAlgo)) {
             sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA1;
         }
 
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLMetaDataTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLMetaDataTest.java
index 1c16e9e..8723b0a 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLMetaDataTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLMetaDataTest.java
@@ -28,6 +28,7 @@ import javax.xml.transform.TransformerException;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+
 import org.apache.cxf.fediz.common.SecurityTestUtil;
 import org.apache.cxf.fediz.core.config.FedizConfigurator;
 import org.apache.cxf.fediz.core.config.FedizContext;
@@ -39,6 +40,7 @@ import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.signature.XMLSignature;
 import org.apache.xml.security.signature.XMLSignatureException;
+
 import org.easymock.EasyMock;
 import org.junit.AfterClass;
 import org.junit.Assert;
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLRequestTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLRequestTest.java
index be48a13..34a3ddb 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLRequestTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLRequestTest.java
@@ -42,12 +42,13 @@ import org.apache.cxf.fediz.core.processor.RedirectionResponse;
 import org.apache.cxf.fediz.core.processor.SAMLProcessorImpl;
 import org.apache.cxf.fediz.core.util.DOMUtils;
 import org.apache.wss4j.common.saml.OpenSAMLUtil;
+import org.opensaml.saml.saml2.core.AuthnRequest;
+import org.opensaml.saml.saml2.core.LogoutRequest;
+
 import org.easymock.EasyMock;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
-import org.opensaml.saml.saml2.core.AuthnRequest;
-import org.opensaml.saml.saml2.core.LogoutRequest;
 
 /**
  * Some tests for creating SAMLRequests using the SAMLProcessorImpl
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLResponseConformanceTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLResponseConformanceTest.java
index e336380..f36c0c5 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLResponseConformanceTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLResponseConformanceTest.java
@@ -63,15 +63,16 @@ import org.apache.wss4j.common.saml.bean.ConditionsBean;
 import org.apache.wss4j.common.saml.bean.SubjectConfirmationDataBean;
 import org.apache.wss4j.common.saml.builder.SAML2Constants;
 import org.apache.wss4j.common.util.DOM2Writer;
-import org.easymock.EasyMock;
 import org.joda.time.DateTime;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
 import org.opensaml.saml.saml2.core.Issuer;
 import org.opensaml.saml.saml2.core.Response;
 import org.opensaml.saml.saml2.core.Status;
 
+import org.easymock.EasyMock;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
 import static org.junit.Assert.fail;
 
 /**
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLResponseTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLResponseTest.java
index 38d3e58..f612e6f 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLResponseTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLResponseTest.java
@@ -78,12 +78,8 @@ import org.apache.wss4j.common.saml.bean.SubjectConfirmationDataBean;
 import org.apache.wss4j.common.saml.builder.SAML2Constants;
 import org.apache.wss4j.common.util.DOM2Writer;
 import org.apache.wss4j.dom.WSConstants;
-import org.easymock.EasyMock;
 import org.joda.time.DateTime;
 import org.joda.time.DateTimeZone;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
 import org.opensaml.saml.common.SAMLObjectContentReference;
 import org.opensaml.saml.common.SignableSAMLObject;
 import org.opensaml.saml.saml2.core.LogoutResponse;
@@ -95,6 +91,11 @@ import org.opensaml.xmlsec.signature.KeyInfo;
 import org.opensaml.xmlsec.signature.Signature;
 import org.opensaml.xmlsec.signature.support.SignatureConstants;
 
+import org.easymock.EasyMock;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
 import static org.junit.Assert.fail;
 
 /**
@@ -1645,9 +1646,9 @@ public class SAMLResponseTest {
 
         String sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1;
         String pubKeyAlgo = issuerCerts[0].getPublicKey().getAlgorithm();
-        if (pubKeyAlgo.equalsIgnoreCase("DSA")) {
+        if ("DSA".equalsIgnoreCase(pubKeyAlgo)) {
             sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_DSA;
-        } else if (pubKeyAlgo.equalsIgnoreCase("EC")) {
+        } else if ("EC".equalsIgnoreCase(pubKeyAlgo)) {
             sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA1;
         }
 
diff --git a/plugins/cxf/src/main/java/org/apache/cxf/fediz/cxf/plugin/FedizRedirectBindingFilter.java b/plugins/cxf/src/main/java/org/apache/cxf/fediz/cxf/plugin/FedizRedirectBindingFilter.java
index b32242f..6a5963e 100644
--- a/plugins/cxf/src/main/java/org/apache/cxf/fediz/cxf/plugin/FedizRedirectBindingFilter.java
+++ b/plugins/cxf/src/main/java/org/apache/cxf/fediz/cxf/plugin/FedizRedirectBindingFilter.java
@@ -464,7 +464,7 @@ public class FedizRedirectBindingFilter extends AbstractServiceProviderFilter
         HttpServletRequest request = messageContext.getHttpServletRequest();
         wfReq.setRequest(request);
 
-        X509Certificate certs[] =
+        X509Certificate[] certs =
             (X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate");
         wfReq.setCerts(certs);
 
diff --git a/plugins/jetty9/src/main/java/org/apache/cxf/fediz/jetty9/FederationAuthenticator.java b/plugins/jetty9/src/main/java/org/apache/cxf/fediz/jetty9/FederationAuthenticator.java
index 08926dd..e78171b 100644
--- a/plugins/jetty9/src/main/java/org/apache/cxf/fediz/jetty9/FederationAuthenticator.java
+++ b/plugins/jetty9/src/main/java/org/apache/cxf/fediz/jetty9/FederationAuthenticator.java
@@ -219,7 +219,7 @@ public class FederationAuthenticator extends LoginAuthenticator {
                 if (session.getAttribute(J_URI) == null) { // || alwaysSaveUri)
                     StringBuffer buf = request.getRequestURL();
                     if (request.getQueryString() != null) {
-                        buf.append("?").append(request.getQueryString());
+                        buf.append('?').append(request.getQueryString());
                     }
                     session.setAttribute(J_URI, buf.toString());
 
@@ -389,7 +389,7 @@ public class FederationAuthenticator extends LoginAuthenticator {
                 if (jUri != null && jPost != null) {
                     StringBuffer buf = request.getRequestURL();
                     if (request.getQueryString() != null) {
-                        buf.append("?").append(request.getQueryString());
+                        buf.append('?').append(request.getQueryString());
                     }
 
                     if (jUri.equals(buf.toString())) {
diff --git a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java
index 8b1a496..74cb355 100644
--- a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java
+++ b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java
@@ -37,7 +37,6 @@ import org.springframework.security.authentication.AuthenticationProvider;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper;
 import org.springframework.security.core.authority.mapping.NullAuthoritiesMapper;
 import org.springframework.security.core.userdetails.AuthenticationUserDetailsService;
@@ -87,7 +86,7 @@ public class FederationAuthenticationProvider implements AuthenticationProvider,
         Assert.notNull(this.federationConfig, "FederationConfig cannot be null.");
     }
 
-    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+    public Authentication authenticate(Authentication authentication) {
         if (!supports(authentication.getClass())) {
             return null;
         }
@@ -107,8 +106,7 @@ public class FederationAuthenticationProvider implements AuthenticationProvider,
         return result;
     }
 
-    private FederationAuthenticationToken authenticateNow(final Authentication authentication)
-        throws AuthenticationException {
+    private FederationAuthenticationToken authenticateNow(final Authentication authentication) {
         try {
             FedizRequest wfReq = (FedizRequest)authentication.getCredentials();
 
diff --git a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationToken.java b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationToken.java
index 816db19..849f512 100644
--- a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationToken.java
+++ b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationToken.java
@@ -86,12 +86,7 @@ public class FederationAuthenticationToken extends AbstractAuthenticationToken
     }
 
     public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append(super.toString());
-        sb.append(" Response: ").append(this.response);
-        sb.append(" Credentials: ").append(this.credentials);
-
-        return sb.toString();
+        return super.toString() + " Response: " + response + " Credentials: " + credentials;
     }
 
     @Override
diff --git a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/preauth/PreAuthenticatedGrantedAuthoritiesUserDetailsFederationService.java b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/preauth/PreAuthenticatedGrantedAuthoritiesUserDetailsFederationService.java
index cf2dc3c..371d6a2 100644
--- a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/preauth/PreAuthenticatedGrantedAuthoritiesUserDetailsFederationService.java
+++ b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/preauth/PreAuthenticatedGrantedAuthoritiesUserDetailsFederationService.java
@@ -24,7 +24,6 @@ import org.apache.cxf.fediz.core.ClaimCollection;
 import org.apache.cxf.fediz.core.FedizPrincipal;
 import org.apache.cxf.fediz.spring.FederationUser;
 import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.authority.GrantedAuthoritiesContainer;
 import org.springframework.security.core.userdetails.AuthenticationUserDetailsService;
@@ -56,7 +55,7 @@ public class PreAuthenticatedGrantedAuthoritiesUserDetailsFederationService
      * GrantedAuthoritiesContainer implementation as returned by
      * the token.getDetails() method.
      */
-    public final UserDetails loadUserDetails(PreAuthenticatedAuthenticationToken token) throws AuthenticationException {
+    public final UserDetails loadUserDetails(PreAuthenticatedAuthenticationToken token) {
         Assert.notNull(token.getDetails());
         Assert.isInstanceOf(GrantedAuthoritiesContainer.class, token.getDetails());
         Assert.isInstanceOf(FedizPrincipal.class, token.getPrincipal());
diff --git a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java
index 9da52e7..aac5e27 100644
--- a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java
+++ b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java
@@ -38,7 +38,6 @@ import org.apache.cxf.fediz.core.processor.RedirectionResponse;
 import org.apache.cxf.fediz.spring.FederationConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
@@ -153,7 +152,7 @@ public class FederationAuthenticationEntryPoint implements AuthenticationEntryPo
     }
 
     @Override
-    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+    public void setApplicationContext(ApplicationContext applicationContext) {
         this.appContext = applicationContext;
     }
 
diff --git a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationFilter.java b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationFilter.java
index 8f4f1a0..b5f2fa1 100644
--- a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationFilter.java
+++ b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationFilter.java
@@ -38,7 +38,6 @@ import org.apache.cxf.fediz.spring.authentication.FederationAuthenticationToken;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.core.context.SecurityContext;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
@@ -58,7 +57,7 @@ public class FederationAuthenticationFilter extends AbstractAuthenticationProces
 
     @Override
     public Authentication attemptAuthentication(final HttpServletRequest request, final HttpServletResponse response)
-        throws AuthenticationException, IOException {
+        throws IOException {
 
         if (isTokenExpired()) {
             throw new ExpiredTokenException("Token is expired");
@@ -76,7 +75,7 @@ public class FederationAuthenticationFilter extends AbstractAuthenticationProces
         wfReq.setRequest(request);
         wfReq.setRequestState(savedRequestState);
 
-        X509Certificate certs[] =
+        X509Certificate[] certs =
             (X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate");
         wfReq.setCerts(certs);
 
diff --git a/pom.xml b/pom.xml
index f69ae50..cf52b57 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,7 +44,7 @@
         <commons.text.version>1.6</commons.text.version>
         <commons.validator.version>1.6</commons.validator.version>
         <cxf.version>3.3.2</cxf.version>
-        <cxf.build-utils.version>3.4.1</cxf.build-utils.version>
+        <cxf.build-utils.version>3.4.2</cxf.build-utils.version>
         <dbcp.version>2.1.1</dbcp.version>
         <easymock.version>4.0.2</easymock.version>
         <ehcache.version>2.10.6</ehcache.version>
@@ -470,7 +470,7 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-checkstyle-plugin</artifactId>
-                    <version>3.0.0</version>
+                    <version>3.1.0</version>
                     <dependencies>
                         <dependency>
                             <groupId>org.apache.cxf.build-utils</groupId>
@@ -480,19 +480,12 @@
                         <dependency>
                             <groupId>com.puppycrawl.tools</groupId>
                             <artifactId>checkstyle</artifactId>
-                            <version>8.7</version>
-                            <exclusions>
-                                <!--  MCHECKSTYLE-156  -->
-                                <exclusion>
-                                    <groupId>com.sun</groupId>
-                                    <artifactId>tools</artifactId>
-                                </exclusion>
-                            </exclusions>
+                            <version>8.22</version>
                        </dependency>
                     </dependencies>
                     <configuration>
-                        <encoding>UTF-8</encoding>
                         <includeResources>false</includeResources>
+                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                     </configuration>
                     <executions>
                         <execution>
@@ -516,7 +509,7 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-pmd-plugin</artifactId>
-                    <version>3.11.0</version>
+                    <version>3.12.0</version>
                     <dependencies>
                         <dependency>
                             <groupId>org.apache.cxf.build-utils</groupId>
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/FedizEntryPoint.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/FedizEntryPoint.java
index f00a9f4..06810de 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/FedizEntryPoint.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/FedizEntryPoint.java
@@ -34,7 +34,6 @@ import org.apache.cxf.fediz.service.idp.domain.Idp;
 import org.apache.cxf.fediz.service.idp.service.ConfigService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
@@ -109,9 +108,9 @@ public class FedizEntryPoint implements AuthenticationEntryPoint,
             String name = names.nextElement();
             String[] values = servletRequest.getParameterValues(name);
             if (values != null && values.length > 0) {
-                builder.append(name).append("=");
+                builder.append(name).append('=');
                 builder.append(URLEncoder.encode(values[0], "UTF-8"));
-                builder.append("&");
+                builder.append('&');
             }
         }
         // Remove trailing ampersand
@@ -139,7 +138,7 @@ public class FedizEntryPoint implements AuthenticationEntryPoint,
     }
 
     @Override
-    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+    public void setApplicationContext(ApplicationContext applicationContext) {
         this.appContext = applicationContext;
     }
 
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSKrbAuthenticationProvider.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSKrbAuthenticationProvider.java
index 3efbf08..32c01c7 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSKrbAuthenticationProvider.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSKrbAuthenticationProvider.java
@@ -45,7 +45,6 @@ import org.ietf.jgss.Oid;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.core.GrantedAuthority;
 
 /**
@@ -65,7 +64,7 @@ public class STSKrbAuthenticationProvider extends STSAuthenticationProvider {
 
 
     @Override
-    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+    public Authentication authenticate(Authentication authentication) {
         // We only handle KerberosServiceRequestTokens
         if (!(authentication instanceof KerberosServiceRequestToken)) {
             return null;
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSPortFilter.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSPortFilter.java
index 3c1ecd2..be6d111 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSPortFilter.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSPortFilter.java
@@ -29,7 +29,6 @@ import javax.servlet.ServletResponse;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 import org.springframework.util.Assert;
@@ -80,7 +79,7 @@ public class STSPortFilter extends GenericFilterBean implements ApplicationConte
     }
 
     @Override
-    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+    public void setApplicationContext(ApplicationContext applicationContext) {
         this.applicationContext = applicationContext;
     }
 
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSPreAuthAuthenticationProvider.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSPreAuthAuthenticationProvider.java
index e985875..143a3c1 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSPreAuthAuthenticationProvider.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSPreAuthAuthenticationProvider.java
@@ -34,7 +34,6 @@ import org.apache.xml.security.keys.content.X509Data;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
 
@@ -47,7 +46,7 @@ public class STSPreAuthAuthenticationProvider extends STSAuthenticationProvider
             .getLogger(STSPreAuthAuthenticationProvider.class);
 
     @Override
-    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+    public Authentication authenticate(Authentication authentication) {
         // We only handle PreAuthenticatedAuthenticationTokens
         if (!(authentication instanceof PreAuthenticatedAuthenticationToken)) {
             return null;
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSUPAuthenticationProvider.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSUPAuthenticationProvider.java
index 7c47f63..7a0e96a 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSUPAuthenticationProvider.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/STSUPAuthenticationProvider.java
@@ -34,7 +34,6 @@ import org.slf4j.LoggerFactory;
 import org.springframework.security.authentication.AuthenticationServiceException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
 import org.springframework.security.web.savedrequest.RequestCache;
@@ -52,7 +51,7 @@ public class STSUPAuthenticationProvider extends STSAuthenticationProvider {
     private RequestCache requestCache = new HttpSessionRequestCache();
 
     @Override
-    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+    public Authentication authenticate(Authentication authentication) {
         // We only handle UsernamePasswordAuthenticationTokens
         if (!(authentication instanceof UsernamePasswordAuthenticationToken)) {
             return null;
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java
index 258bbde..1121364 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/STSClientAction.java
@@ -247,7 +247,7 @@ public class STSClientAction {
         if (HTTP_DOCS_OASIS_OPEN_ORG_WS_SX_WS_TRUST_200512_PUBLICKEY.equals(stsKeyType)) {
             HttpServletRequest servletRequest = WebUtils.getHttpServletRequest(context);
             if (servletRequest != null) {
-                X509Certificate certs[] = (X509Certificate[])servletRequest
+                X509Certificate[] certs = (X509Certificate[])servletRequest
                     .getAttribute("javax.servlet.request.X509Certificate");
                 if (certs != null && certs.length > 0) {
                     sts.setUseCertificateForConfirmationKeyInfo(true);
@@ -350,7 +350,7 @@ public class STSClientAction {
         if (!isPortSet) {
             String updatedUrl = LocalServerResolver.resolve(this.wsdlLocation, context);
             setSTSWsdlUrl(updatedUrl);
-            LOG.info("STS WSDL URL updated to {}", updatedUrl.toString());
+            LOG.info("STS WSDL URL updated to {}", updatedUrl);
         }
     }
 
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AbstractSamlResponseCreator.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AbstractSamlResponseCreator.java
index 2baad7b..2b5243e 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AbstractSamlResponseCreator.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AbstractSamlResponseCreator.java
@@ -98,9 +98,9 @@ abstract class AbstractSamlResponseCreator {
         String sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1;
         String pubKeyAlgo = issuerCerts[0].getPublicKey().getAlgorithm();
         LOG.debug("automatic sig algo detection: {}", pubKeyAlgo);
-        if (pubKeyAlgo.equalsIgnoreCase("DSA")) {
+        if ("DSA".equalsIgnoreCase(pubKeyAlgo)) {
             sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_DSA;
-        } else if (pubKeyAlgo.equalsIgnoreCase("EC")) {
+        } else if ("EC".equalsIgnoreCase(pubKeyAlgo)) {
             sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA1;
         }
         LOG.debug("Using Signature algorithm {}", sigAlgo);
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/LocalRedirectCreator.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/LocalRedirectCreator.java
index 0111c2c..0379812 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/LocalRedirectCreator.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/LocalRedirectCreator.java
@@ -33,17 +33,17 @@ import org.springframework.webflow.execution.RequestContext;
 public class LocalRedirectCreator {
 
     public String createRedirectURL(RequestContext context, Idp idp) throws UnsupportedEncodingException {
-        StringBuilder redirectURL = new StringBuilder();
-        redirectURL.append(idp.getIdpUrl().toString()).append("?");
+        StringBuilder redirectURL = new StringBuilder(25);
+        redirectURL.append(idp.getIdpUrl().toString()).append('?');
 
         String relayState = (String)WebUtils.getAttributeFromFlowScope(context, "RelayState");
-        redirectURL.append("RelayState=").append(relayState).append("&");
+        redirectURL.append("RelayState=").append(relayState).append('&');
         String samlRequest = (String)WebUtils.getAttributeFromFlowScope(context, "SAMLRequest");
         redirectURL.append("SAMLRequest=").append(URLEncoder.encode(samlRequest, "UTF-8"));
 
         String signature = (String)WebUtils.getAttributeFromFlowScope(context, "Signature");
         if (signature != null) {
-            redirectURL.append("&");
+            redirectURL.append('&');
             redirectURL.append("Signature=").append(URLEncoder.encode(signature, "UTF-8"));
         }
 
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/protocols/AbstractTrustedIdpOAuth2ProtocolHandler.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/protocols/AbstractTrustedIdpOAuth2ProtocolHandler.java
index 6b62c39..57e9572 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/protocols/AbstractTrustedIdpOAuth2ProtocolHandler.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/protocols/AbstractTrustedIdpOAuth2ProtocolHandler.java
@@ -96,26 +96,13 @@ public abstract class AbstractTrustedIdpOAuth2ProtocolHandler extends AbstractTr
         LOG.debug("Using scope: {}", scope);
 
         try {
-            StringBuilder sb = new StringBuilder();
-            sb.append(trustedIdp.getUrl());
-            sb.append("?");
-            sb.append("response_type").append('=');
-            sb.append("code");
-            sb.append("&");
-            sb.append("client_id").append('=');
-            sb.append(clientId);
-            sb.append("&");
-            sb.append("redirect_uri").append('=');
-            sb.append(URLEncoder.encode(idp.getIdpUrl().toString(), "UTF-8"));
-            sb.append("&");
-            sb.append("scope").append('=');
-            sb.append(URLEncoder.encode(scope, "UTF-8"));
-
-            String state = context.getFlowScope().getString(IdpConstants.TRUSTED_IDP_CONTEXT);
-            sb.append("&").append("state").append('=');
-            sb.append(state);
-
-            return new URL(sb.toString());
+            final String url = trustedIdp.getUrl()
+                    + "?response_type=code"
+                    + "&client_id=" + clientId
+                    + "&redirect_uri=" + URLEncoder.encode(idp.getIdpUrl().toString(), "UTF-8")
+                    + "&scope=" + URLEncoder.encode(scope, "UTF-8")
+                    + "&state=" + context.getFlowScope().getString(IdpConstants.TRUSTED_IDP_CONTEXT);
+            return new URL(url);
         } catch (MalformedURLException ex) {
             LOG.error("Invalid Redirect URL for Trusted Idp", ex);
             throw new IllegalStateException("Invalid Redirect URL for Trusted Idp");
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpSAMLProtocolHandler.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpSAMLProtocolHandler.java
index 3a2764e..bc6c417 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpSAMLProtocolHandler.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpSAMLProtocolHandler.java
@@ -254,7 +254,7 @@ public class TrustedIdpSAMLProtocolHandler extends AbstractTrustedIdpProtocolHan
         String pubKeyAlgo = cert.getPublicKey().getAlgorithm();
         String jceSigAlgo = "SHA1withRSA";
         LOG.debug("automatic sig algo detection: " + pubKeyAlgo);
-        if (pubKeyAlgo.equalsIgnoreCase("DSA")) {
+        if ("DSA".equalsIgnoreCase(pubKeyAlgo)) {
             sigAlgo = SSOConstants.DSA_SHA1;
             jceSigAlgo = "SHA1withDSA";
         }
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpWSFedProtocolHandler.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpWSFedProtocolHandler.java
index c3b75fc..210c8ca 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpWSFedProtocolHandler.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpWSFedProtocolHandler.java
@@ -81,25 +81,25 @@ public class TrustedIdpWSFedProtocolHandler extends AbstractTrustedIdpProtocolHa
         try {
             StringBuilder sb = new StringBuilder();
             sb.append(trustedIdp.getUrl());
-            sb.append("?").append(FederationConstants.PARAM_ACTION).append('=');
+            sb.append('?').append(FederationConstants.PARAM_ACTION).append('=');
             sb.append(FederationConstants.ACTION_SIGNIN);
-            sb.append("&").append(FederationConstants.PARAM_TREALM).append('=');
+            sb.append('&').append(FederationConstants.PARAM_TREALM).append('=');
             sb.append(URLEncoder.encode(idp.getRealm(), "UTF-8"));
-            sb.append("&").append(FederationConstants.PARAM_REPLY).append('=');
+            sb.append('&').append(FederationConstants.PARAM_REPLY).append('=');
             sb.append(URLEncoder.encode(idp.getIdpUrl().toString(), "UTF-8"));
 
             if (isBooleanPropertyConfigured(trustedIdp, HOME_REALM_PROPAGATION, true)) {
-                sb.append("&").append(FederationConstants.PARAM_HOME_REALM).append('=');
+                sb.append('&').append(FederationConstants.PARAM_HOME_REALM).append('=');
                 sb.append(trustedIdp.getRealm());
             }
 
             String wfresh = context.getFlowScope().getString(FederationConstants.PARAM_FRESHNESS);
             if (wfresh != null) {
-                sb.append("&").append(FederationConstants.PARAM_FRESHNESS).append('=');
+                sb.append('&').append(FederationConstants.PARAM_FRESHNESS).append('=');
                 sb.append(URLEncoder.encode(wfresh, "UTF-8"));
             }
             String wctx = context.getFlowScope().getString(IdpConstants.TRUSTED_IDP_CONTEXT);
-            sb.append("&").append(FederationConstants.PARAM_CONTEXT).append('=');
+            sb.append('&').append(FederationConstants.PARAM_CONTEXT).append('=');
             sb.append(wctx);
 
             return new URL(sb.toString());
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderSpring.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderSpring.java
index 4cbd5d0..2d936d2 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderSpring.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderSpring.java
@@ -67,15 +67,12 @@ public class DBLoaderSpring implements DBLoader, EnvironmentAware {
 
     @Override
     public void load() {
-
-        GenericXmlApplicationContext ctx = null;
-        try {
+        try (GenericXmlApplicationContext ctx = new GenericXmlApplicationContext()) {
 
             if (resource == null) {
                 LOG.warn("Resource null for DBLoaderSpring");
             }
 
-            ctx = new GenericXmlApplicationContext();
             if (environment instanceof ConfigurableEnvironment) {
                 ctx.setEnvironment((ConfigurableEnvironment) environment);
             }
@@ -131,10 +128,6 @@ public class DBLoaderSpring implements DBLoader, EnvironmentAware {
             em.flush();
         } catch (Exception ex) {
             LOG.warn("Failed to initialize DB with data", ex);
-        } finally {
-            if (ctx != null) {
-                ctx.close();
-            }
         }
     }
 
diff --git a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/beans/STSClientActionTest.java b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/beans/STSClientActionTest.java
index 6f4ae76..18c40ba 100644
--- a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/beans/STSClientActionTest.java
+++ b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/beans/STSClientActionTest.java
@@ -21,10 +21,12 @@ package org.apache.cxf.fediz.service.idp.beans;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
-import org.junit.Test;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.webflow.execution.RequestContext;
 import org.springframework.webflow.test.MockRequestContext;
+
+import org.junit.Test;
+
 import static org.junit.Assert.assertEquals;
 
 public class STSClientActionTest {
diff --git a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java
index ba41a15..4605760 100644
--- a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java
+++ b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java
@@ -26,11 +26,6 @@ import java.util.List;
 import org.apache.cxf.fediz.service.idp.domain.Application;
 import org.apache.cxf.fediz.service.idp.domain.RequestClaim;
 import org.apache.cxf.fediz.service.idp.service.ApplicationDAO;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.dao.EmptyResultDataAccessException;
@@ -39,6 +34,10 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.util.Assert;
 
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = { "classpath:testContext.xml" })
diff --git a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPATest.java b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPATest.java
index cabbf4b..50061b2 100644
--- a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPATest.java
+++ b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPATest.java
@@ -23,11 +23,6 @@ import java.util.List;
 
 import org.apache.cxf.fediz.service.idp.domain.Claim;
 import org.apache.cxf.fediz.service.idp.service.ClaimDAO;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.dao.EmptyResultDataAccessException;
@@ -35,6 +30,10 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.util.Assert;
 
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = { "classpath:testContext.xml" })
diff --git a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPATest.java b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPATest.java
index 9172ea6..d71f6f2 100644
--- a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPATest.java
+++ b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementDAOJPATest.java
@@ -22,11 +22,6 @@ import java.util.List;
 
 import org.apache.cxf.fediz.service.idp.domain.Entitlement;
 import org.apache.cxf.fediz.service.idp.service.EntitlementDAO;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.dao.EmptyResultDataAccessException;
@@ -34,6 +29,10 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.util.Assert;
 
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = { "classpath:testContext.xml" })
diff --git a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPATest.java b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPATest.java
index 7ebb375..e931eb6 100644
--- a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPATest.java
+++ b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpDAOJPATest.java
@@ -33,9 +33,6 @@ import org.apache.cxf.fediz.service.idp.domain.Idp;
 import org.apache.cxf.fediz.service.idp.domain.TrustedIdp;
 import org.apache.cxf.fediz.service.idp.service.IdpDAO;
 import org.apache.wss4j.dom.WSConstants;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.dao.EmptyResultDataAccessException;
@@ -44,6 +41,10 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.util.Assert;
 
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = { "classpath:testContext.xml" })
@@ -63,7 +64,7 @@ public class IdpDAOJPATest {
     public void testReadAllIdps() {
         List<Idp> idps = idpDAO.getIdps(0, 999, null);
         // Idp could have been removed, Order not given as per JUnit design
-        Assert.isTrue(0 < idps.size(), "Size doesn't match [" + idps.size() + "]");
+        Assert.isTrue(!idps.isEmpty(), "Size doesn't match [" + idps.size() + "]");
     }
 
 
diff --git a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpDAOJPATest.java b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpDAOJPATest.java
index 9e65ed0..96145a6 100644
--- a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpDAOJPATest.java
+++ b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpDAOJPATest.java
@@ -24,11 +24,6 @@ import org.apache.cxf.fediz.service.idp.domain.FederationType;
 import org.apache.cxf.fediz.service.idp.domain.TrustType;
 import org.apache.cxf.fediz.service.idp.domain.TrustedIdp;
 import org.apache.cxf.fediz.service.idp.service.TrustedIdpDAO;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.dao.EmptyResultDataAccessException;
@@ -36,6 +31,11 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.util.Assert;
 
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = { "classpath:testContext.xml" })
diff --git a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/util/MetadataWriterTest.java b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/util/MetadataWriterTest.java
index 1b5929f..564250a 100644
--- a/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/util/MetadataWriterTest.java
+++ b/services/idp-core/src/test/java/org/apache/cxf/fediz/service/idp/util/MetadataWriterTest.java
@@ -20,16 +20,18 @@
 package org.apache.cxf.fediz.service.idp.util;
 
 import org.w3c.dom.Document;
+
 import org.apache.cxf.fediz.service.idp.domain.Idp;
 import org.apache.cxf.fediz.service.idp.metadata.IdpMetadataWriter;
 import org.apache.cxf.fediz.service.idp.service.ConfigService;
 import org.apache.wss4j.common.util.DOM2Writer;
-import org.junit.BeforeClass;
-import org.junit.Test;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 import org.springframework.util.Assert;
 
+import org.junit.BeforeClass;
+import org.junit.Test;
+
 public class MetadataWriterTest {
 
     private static ApplicationContext applicationContext;
diff --git a/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java b/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java
index 7e6614f..818d058 100644
--- a/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java
+++ b/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java
@@ -40,6 +40,7 @@ import org.apache.cxf.fediz.service.idp.rest.Claims;
 import org.apache.cxf.fediz.service.idp.rest.Entitlements;
 import org.apache.cxf.fediz.service.idp.rest.Idps;
 import org.apache.cxf.fediz.service.idp.rest.Roles;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/FedizSubjectCreator.java b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/FedizSubjectCreator.java
index 6058361..32fa63a 100644
--- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/FedizSubjectCreator.java
+++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/FedizSubjectCreator.java
@@ -62,8 +62,7 @@ public class FedizSubjectCreator implements SubjectCreator {
     private long timeToLive;
 
     @Override
-    public OidcUserSubject createUserSubject(MessageContext mc,
-                                             MultivaluedMap<String, String> params) throws OAuthServiceException {
+    public OidcUserSubject createUserSubject(MessageContext mc, MultivaluedMap<String, String> params) {
         Principal principal = mc.getSecurityContext().getUserPrincipal();
 
         if (!(principal instanceof FedizPrincipal)) {
diff --git a/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/SamlRealmCodec.java b/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/SamlRealmCodec.java
index f045c01..83ae9fc 100644
--- a/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/SamlRealmCodec.java
+++ b/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/SamlRealmCodec.java
@@ -43,7 +43,7 @@ public class SamlRealmCodec implements SAMLRealmCodec {
     }
 
     protected String parseCNValue(String name) {
-        int len = name.indexOf(",") > 0 ? name.indexOf(",") : name.length();
+        int len = name.indexOf(',') > 0 ? name.indexOf(',') : name.length();
         String realm = name.substring(name.indexOf("CN=") + 3, len);
 
         if (uppercase) {
diff --git a/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java b/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
index b9a8e77..41eaf19 100644
--- a/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
+++ b/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/realms/UriRealmParser.java
@@ -34,7 +34,7 @@ public class UriRealmParser implements RealmParser {
     private Map<String, Object> realmMap;
 
     @Override
-    public String parseRealm(Map<String, Object> messageContext) throws STSException {
+    public String parseRealm(Map<String, Object> messageContext) {
         String url = (String)messageContext.get("org.apache.cxf.request.url");
 
         // Get the realm of the request url
diff --git a/services/sts/src/test/java/org/apache/cxf/fediz/sts/AbstractSTSTest.java b/services/sts/src/test/java/org/apache/cxf/fediz/sts/AbstractSTSTest.java
index 0d638f3..f9f70cd 100644
--- a/services/sts/src/test/java/org/apache/cxf/fediz/sts/AbstractSTSTest.java
+++ b/services/sts/src/test/java/org/apache/cxf/fediz/sts/AbstractSTSTest.java
@@ -37,7 +37,9 @@ import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLStreamException;
 
 import org.w3c.dom.Element;
+
 import org.xml.sax.SAXException;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.configuration.jsse.TLSClientParameters;
 import org.apache.cxf.staxutils.StaxUtils;
@@ -53,9 +55,10 @@ import org.apache.cxf.ws.security.trust.STSClient;
 import org.apache.cxf.ws.security.trust.STSUtils;
 import org.apache.wss4j.common.saml.SamlAssertionWrapper;
 import org.apache.wss4j.dom.WSConstants;
-import org.junit.Assert;
 import org.opensaml.saml.saml2.core.Attribute;
 
+import org.junit.Assert;
+
 
 public abstract class AbstractSTSTest {
 
diff --git a/services/sts/src/test/java/org/apache/cxf/fediz/sts/realms/ITCrossRealmTest.java b/services/sts/src/test/java/org/apache/cxf/fediz/sts/realms/ITCrossRealmTest.java
index 076ddb6..bdeb5c5 100644
--- a/services/sts/src/test/java/org/apache/cxf/fediz/sts/realms/ITCrossRealmTest.java
+++ b/services/sts/src/test/java/org/apache/cxf/fediz/sts/realms/ITCrossRealmTest.java
@@ -31,9 +31,10 @@ import org.apache.cxf.configuration.jsse.TLSClientParameters;
 import org.apache.cxf.fediz.sts.AbstractSTSTest;
 import org.apache.cxf.ws.security.tokenstore.SecurityToken;
 import org.apache.wss4j.common.saml.SamlAssertionWrapper;
+import org.opensaml.saml.saml2.core.Attribute;
+
 import org.junit.Assert;
 import org.junit.BeforeClass;
-import org.opensaml.saml.saml2.core.Attribute;
 
 /**
  * Some unit tests for the CXF STSClient Issue Binding.
diff --git a/services/sts/src/test/java/org/apache/cxf/fediz/sts/realms/RealmExtensionIdentityMapperTest.java b/services/sts/src/test/java/org/apache/cxf/fediz/sts/realms/RealmExtensionIdentityMapperTest.java
index 4eb98e1..0631f11 100644
--- a/services/sts/src/test/java/org/apache/cxf/fediz/sts/realms/RealmExtensionIdentityMapperTest.java
+++ b/services/sts/src/test/java/org/apache/cxf/fediz/sts/realms/RealmExtensionIdentityMapperTest.java
@@ -23,6 +23,7 @@ import java.security.Principal;
 
 import org.apache.cxf.fediz.service.sts.realms.RealmExtensionIdentityMapper;
 import org.apache.wss4j.common.principal.CustomTokenPrincipal;
+
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
diff --git a/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java b/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
index 797f870..0c922d6 100644
--- a/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
+++ b/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
@@ -43,6 +43,7 @@ import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.wss4j.dom.engine.WSSConfig;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -118,7 +119,7 @@ public class CustomParametersTest {
             File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
             String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             if (content.contains("idp.https.port")) {
-                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
+                content = content.replaceAll("\\$\\{idp.https.port\\}", idpHttpsPort);
 
                 File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
                 Files.write(f2.toPath(), content.getBytes());
@@ -236,7 +237,8 @@ public class CustomParametersTest {
         String user = "alice";
         String password = "ecila";
 
-        final String bodyTextContent = HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), "signinresponseform");
+        final String bodyTextContent =
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), "signinresponseform");
 
         Assert.assertTrue("Principal not " + user,
                           bodyTextContent.contains("userPrincipal=" + user));
diff --git a/systests/cxf/src/test/java/org/apache/cxf/fediz/systests/cxf/FederationTest.java b/systests/cxf/src/test/java/org/apache/cxf/fediz/systests/cxf/FederationTest.java
index 434e572..30153c7 100644
--- a/systests/cxf/src/test/java/org/apache/cxf/fediz/systests/cxf/FederationTest.java
+++ b/systests/cxf/src/test/java/org/apache/cxf/fediz/systests/cxf/FederationTest.java
@@ -21,24 +21,25 @@ package org.apache.cxf.fediz.systests.cxf;
 
 import java.io.File;
 
+import com.gargoylesoftware.htmlunit.CookieManager;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.DomElement;
+import com.gargoylesoftware.htmlunit.html.DomNodeList;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.cxf.fediz.systests.common.AbstractTests;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 
-import com.gargoylesoftware.htmlunit.CookieManager;
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.html.DomElement;
-import com.gargoylesoftware.htmlunit.html.DomNodeList;
-import com.gargoylesoftware.htmlunit.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
-
 /**
  * A test for WS-Federation using the CXF plugin (deployed in Tomcat).
  */
diff --git a/systests/cxf/src/test/java/org/apache/cxf/fediz/systests/cxf/TokenExpiryTest.java b/systests/cxf/src/test/java/org/apache/cxf/fediz/systests/cxf/TokenExpiryTest.java
index 1a1c649..835d61a 100644
--- a/systests/cxf/src/test/java/org/apache/cxf/fediz/systests/cxf/TokenExpiryTest.java
+++ b/systests/cxf/src/test/java/org/apache/cxf/fediz/systests/cxf/TokenExpiryTest.java
@@ -25,6 +25,7 @@ import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.cxf.fediz.systests.common.AbstractExpiryTests;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/systests/federation/samlsso/SAMLSSOTest.java b/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/systests/federation/samlsso/SAMLSSOTest.java
index 3620624..dbec2c3 100644
--- a/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/systests/federation/samlsso/SAMLSSOTest.java
+++ b/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/systests/federation/samlsso/SAMLSSOTest.java
@@ -43,6 +43,7 @@ import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/systests/federation/unknown-subject/src/test/java/org/apache/cxf/fediz/systests/federation/unknown/WSFedTest.java b/systests/federation/unknown-subject/src/test/java/org/apache/cxf/fediz/systests/federation/unknown/WSFedTest.java
index 9e67988..96d64e0 100644
--- a/systests/federation/unknown-subject/src/test/java/org/apache/cxf/fediz/systests/federation/unknown/WSFedTest.java
+++ b/systests/federation/unknown-subject/src/test/java/org/apache/cxf/fediz/systests/federation/unknown/WSFedTest.java
@@ -43,6 +43,7 @@ import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/systests/federation/wsfed/WSFedTest.java b/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/systests/federation/wsfed/WSFedTest.java
index fd0975a..ab191df 100644
--- a/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/systests/federation/wsfed/WSFedTest.java
+++ b/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/systests/federation/wsfed/WSFedTest.java
@@ -48,10 +48,13 @@ import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
+
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 /**
  * This is a test for federation using a WS-Federation enabled web application. The web application is configured
@@ -68,11 +71,11 @@ public class WSFedTest {
         IDP, REALMB, SAMLSSO, OIDC, RP
     }
 
-    private static final String idpHttpsPort = System.getProperty("idp.https.port");
-    private static final String idpRealmbHttpsPort = System.getProperty("idp.realmb.https.port");
-    private static final String idpSamlSSOHttpsPort = System.getProperty("idp.samlsso.https.port");
-    private static final String idpOIDCHttpsPort = System.getProperty("idp.oidc.https.port");
-    private static final String rpHttpsPort = System.getProperty("rp.https.port");
+    private static final String IDP_HTTPS_PORT = System.getProperty("idp.https.port");
+    private static final String IDP_REALMB_HTTPS_PORT = System.getProperty("idp.realmb.https.port");
+    private static final String IDP_SAMLSSO_HTTPS_PORT = System.getProperty("idp.samlsso.https.port");
+    private static final String IDP_OIDC_HTTPS_PORT = System.getProperty("idp.oidc.https.port");
+    private static final String RP_HTTPS_PORT = System.getProperty("rp.https.port");
 
     private static Tomcat idpServer;
     private static Tomcat idpRealmbServer;
@@ -82,17 +85,17 @@ public class WSFedTest {
 
     @BeforeClass
     public static void init() throws Exception {
-        assertNotNull("Property 'idp.https.port' null", idpHttpsPort);
-        assertNotNull("Property 'idp.realmb.https.port' null", idpRealmbHttpsPort);
-        assertNotNull("Property 'idp.samlsso.https.port' null", idpSamlSSOHttpsPort);
-        assertNotNull("Property 'idp.oidc.https.port' null", idpOIDCHttpsPort);
-        assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
-
-        idpServer = startServer(ServerType.IDP, idpHttpsPort);
-        idpRealmbServer = startServer(ServerType.REALMB, idpRealmbHttpsPort);
-        idpSamlSSOServer = startServer(ServerType.SAMLSSO, idpSamlSSOHttpsPort);
-        idpOIDCServer = startServer(ServerType.OIDC, idpOIDCHttpsPort);
-        rpServer = startServer(ServerType.RP, rpHttpsPort);
+        assertNotNull("Property 'idp.https.port' null", IDP_HTTPS_PORT);
+        assertNotNull("Property 'idp.realmb.https.port' null", IDP_REALMB_HTTPS_PORT);
+        assertNotNull("Property 'idp.samlsso.https.port' null", IDP_SAMLSSO_HTTPS_PORT);
+        assertNotNull("Property 'idp.oidc.https.port' null", IDP_OIDC_HTTPS_PORT);
+        assertNotNull("Property 'rp.https.port' null", RP_HTTPS_PORT);
+
+        idpServer = startServer(ServerType.IDP, IDP_HTTPS_PORT);
+        idpRealmbServer = startServer(ServerType.REALMB, IDP_REALMB_HTTPS_PORT);
+        idpSamlSSOServer = startServer(ServerType.SAMLSSO, IDP_SAMLSSO_HTTPS_PORT);
+        idpOIDCServer = startServer(ServerType.OIDC, IDP_OIDC_HTTPS_PORT);
+        rpServer = startServer(ServerType.RP, RP_HTTPS_PORT);
     }
 
     private static Tomcat startServer(ServerType serverType, String port)
@@ -197,15 +200,15 @@ public class WSFedTest {
     }
 
     public String getIdpHttpsPort() {
-        return idpHttpsPort;
+        return IDP_HTTPS_PORT;
     }
 
     public String getIdpRealmbHttpsPort() {
-        return idpRealmbHttpsPort;
+        return IDP_REALMB_HTTPS_PORT;
     }
 
     public String getRpHttpsPort() {
-        return rpHttpsPort;
+        return RP_HTTPS_PORT;
     }
 
     public String getServletContextName() {
@@ -221,7 +224,7 @@ public class WSFedTest {
         String password = "ECILA";
 
         final String bodyTextContent =
-            login(url, user, password, getIdpRealmbHttpsPort(), idpHttpsPort);
+            login(url, user, password, getIdpRealmbHttpsPort(), IDP_HTTPS_PORT);
 
         assertTrue("Principal not alice",
                           bodyTextContent.contains("userPrincipal=alice"));
@@ -283,7 +286,7 @@ public class WSFedTest {
         String password = "ECILA";
 
         final String bodyTextContent =
-            login(url, user, password, idpSamlSSOHttpsPort, idpHttpsPort, false);
+            login(url, user, password, IDP_SAMLSSO_HTTPS_PORT, IDP_HTTPS_PORT, false);
 
         assertTrue("Principal not alice",
                           bodyTextContent.contains("userPrincipal=alice"));
@@ -314,7 +317,7 @@ public class WSFedTest {
         String password = "ECILA";
 
         final String bodyTextContent =
-            login(url, user, password, idpSamlSSOHttpsPort, idpHttpsPort, true);
+            login(url, user, password, IDP_SAMLSSO_HTTPS_PORT, IDP_HTTPS_PORT, true);
 
         assertTrue("Principal not alice",
                           bodyTextContent.contains("userPrincipal=alice"));
@@ -343,7 +346,7 @@ public class WSFedTest {
         String password = "ECILA";
 
         final String bodyTextContent =
-            loginOIDC(url, user, password, idpOIDCHttpsPort, idpHttpsPort);
+            loginOIDC(url, user, password, IDP_OIDC_HTTPS_PORT, IDP_HTTPS_PORT);
 
         assertTrue("Principal not alice",
                           bodyTextContent.contains("userPrincipal=alice"));
diff --git a/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java b/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
index ee710ac..53eca9a 100644
--- a/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
+++ b/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
@@ -54,6 +54,7 @@ import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.wss4j.dom.engine.WSSConfig;
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.signature.XMLSignature;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/ClientCertificatePreAuthSpringTest.java b/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/ClientCertificatePreAuthSpringTest.java
index 673a306..cb5e08d 100644
--- a/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/ClientCertificatePreAuthSpringTest.java
+++ b/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/ClientCertificatePreAuthSpringTest.java
@@ -28,6 +28,7 @@ import org.apache.cxf.fediz.systests.common.AbstractClientCertTests;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.util.resource.Resource;
 import org.eclipse.jetty.xml.XmlConfiguration;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/ClientCertificateTest.java b/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/ClientCertificateTest.java
index b2a86f4..18d6c7e 100644
--- a/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/ClientCertificateTest.java
+++ b/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/ClientCertificateTest.java
@@ -28,6 +28,7 @@ import org.apache.cxf.fediz.systests.common.AbstractClientCertTests;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.util.resource.Resource;
 import org.eclipse.jetty.xml.XmlConfiguration;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/JettyPreAuthSpringTest.java b/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/JettyPreAuthSpringTest.java
index 4037c04..b44ac6c 100644
--- a/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/JettyPreAuthSpringTest.java
+++ b/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/JettyPreAuthSpringTest.java
@@ -27,6 +27,7 @@ import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.cxf.fediz.systests.common.AbstractTests;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/JettyTest.java b/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/JettyTest.java
index a87d68d..c80f955 100644
--- a/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/JettyTest.java
+++ b/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/JettyTest.java
@@ -25,6 +25,7 @@ import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.cxf.fediz.systests.common.AbstractTests;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/TokenExpiryTest.java b/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/TokenExpiryTest.java
index 78306f1..31870c9 100644
--- a/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/TokenExpiryTest.java
+++ b/systests/jetty9/src/test/java/org/apache/cxf/fediz/systests/jetty9/TokenExpiryTest.java
@@ -28,6 +28,7 @@ import org.apache.cxf.fediz.systests.common.AbstractExpiryTests;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.util.resource.Resource;
 import org.eclipse.jetty.xml.XmlConfiguration;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/fediz/systests/kerberos/KerberosTest.java b/systests/kerberos/src/test/java/org/apache/cxf/fediz/systests/kerberos/KerberosTest.java
index bf2baa5..c2ca4a3 100644
--- a/systests/kerberos/src/test/java/org/apache/cxf/fediz/systests/kerberos/KerberosTest.java
+++ b/systests/kerberos/src/test/java/org/apache/cxf/fediz/systests/kerberos/KerberosTest.java
@@ -48,6 +48,7 @@ import org.ietf.jgss.GSSException;
 import org.ietf.jgss.GSSManager;
 import org.ietf.jgss.GSSName;
 import org.ietf.jgss.Oid;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/systests/ldap/src/test/java/org/apache/cxf/fediz/systests/ldap/LDAPTest.java b/systests/ldap/src/test/java/org/apache/cxf/fediz/systests/ldap/LDAPTest.java
index 96f10a7..bf46b16 100644
--- a/systests/ldap/src/test/java/org/apache/cxf/fediz/systests/ldap/LDAPTest.java
+++ b/systests/ldap/src/test/java/org/apache/cxf/fediz/systests/ldap/LDAPTest.java
@@ -43,6 +43,7 @@ import org.apache.directory.server.core.annotations.CreatePartition;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.wss4j.dom.engine.WSSConfig;
+
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -106,7 +107,7 @@ public class LDAPTest extends AbstractLdapTestUnit {
         rpServer = startServer(false, rpHttpsPort);
     }
 
-    public void updatePort() throws Exception {
+    private void updatePort() throws Exception {
         if (!portUpdated) {
             String basedir = System.getProperty("basedir");
             if (basedir == null) {
@@ -117,7 +118,7 @@ public class LDAPTest extends AbstractLdapTestUnit {
             File f = new File(basedir + "/src/test/resources/sts/ldap.xml");
 
             String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
-            content = content.replaceAll("portno", "" + super.getLdapServer().getPort());
+            content = content.replaceAll("portno", Integer.toString(getLdapServer().getPort()));
 
             File f2 = new File(basedir + "/target/tomcat/idp/webapps/fediz-idp-sts/WEB-INF/endpoints/ldap.xml");
             Files.write(f2.toPath(), content.getBytes());
@@ -125,7 +126,7 @@ public class LDAPTest extends AbstractLdapTestUnit {
             // Read in ldap.jaas and substitute in the correct port
             f = new File(basedir + "/src/test/resources/ldap.jaas");
             content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
-            content = content.replaceAll("portno", "" + super.getLdapServer().getPort());
+            content = content.replaceAll("portno", Integer.toString(getLdapServer().getPort()));
 
             f2 = new File(basedir + "/target/test-classes/ldap.jaas");
             Files.write(f2.toPath(), content.getBytes());
diff --git a/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/AbstractOIDCTest.java b/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/AbstractOIDCTest.java
index 03979c5..f1eedf1 100644
--- a/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/AbstractOIDCTest.java
+++ b/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/AbstractOIDCTest.java
@@ -44,20 +44,6 @@ import java.util.TimeZone;
 
 import javax.servlet.ServletException;
 
-import org.apache.catalina.Context;
-import org.apache.catalina.LifecycleException;
-import org.apache.catalina.LifecycleState;
-import org.apache.catalina.connector.Connector;
-import org.apache.catalina.startup.Tomcat;
-import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
-import org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm;
-import org.apache.cxf.rs.security.jose.jws.JwsJwtCompactConsumer;
-import org.apache.cxf.rs.security.jose.jwt.JwtConstants;
-import org.apache.cxf.rs.security.jose.jwt.JwtToken;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.wss4j.common.util.Loader;
-
 import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
 import com.gargoylesoftware.htmlunit.HttpMethod;
 import com.gargoylesoftware.htmlunit.UnexpectedPage;
@@ -76,15 +62,34 @@ import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
 import com.gargoylesoftware.htmlunit.util.NameValuePair;
 import com.gargoylesoftware.htmlunit.util.WebConnectionWrapper;
 
-import static org.junit.Assert.*;
+import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleState;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.startup.Tomcat;
+import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
+import org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm;
+import org.apache.cxf.rs.security.jose.jws.JwsJwtCompactConsumer;
+import org.apache.cxf.rs.security.jose.jwt.JwtConstants;
+import org.apache.cxf.rs.security.jose.jwt.JwtToken;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.wss4j.common.util.Loader;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * Some OIDC tests.
  */
 abstract class AbstractOIDCTest {
 
-    private static final String idpHttpsPort = System.getProperty("idp.https.port");
-    private static final String rpHttpsPort = System.getProperty("rp.https.port");
+    private static final String IDP_HTTPS_PORT = System.getProperty("idp.https.port");
+    private static final String RP_HTTPS_PORT = System.getProperty("rp.https.port");
 
     private static Tomcat idpServer;
     private static Tomcat rpServer;
@@ -94,13 +99,13 @@ abstract class AbstractOIDCTest {
     private static String storedClientPassword;
 
     protected static void startServer(String servletContextName, String fedizConfigPath) throws Exception {
-        assertNotNull("Property 'idp.https.port' null", idpHttpsPort);
-        assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
+        assertNotNull("Property 'idp.https.port' null", IDP_HTTPS_PORT);
+        assertNotNull("Property 'rp.https.port' null", RP_HTTPS_PORT);
 
-        idpServer = startServer(idpHttpsPort, null, null);
-        rpServer = startServer(rpHttpsPort, servletContextName, fedizConfigPath);
+        idpServer = startServer(IDP_HTTPS_PORT, null, null);
+        rpServer = startServer(RP_HTTPS_PORT, servletContextName, fedizConfigPath);
 
-        loginToClientsPage(rpHttpsPort, idpHttpsPort, servletContextName);
+        loginToClientsPage(RP_HTTPS_PORT, IDP_HTTPS_PORT, servletContextName);
     }
 
     private static Tomcat startServer(String port, String servletContextName, String fedizConfigPath)
@@ -148,7 +153,7 @@ abstract class AbstractOIDCTest {
             try (InputStream is = AbstractOIDCTest.class.getResourceAsStream('/' + fedizConfigPath)) {
                 byte[] content = new byte[is.available()];
                 is.read(content);
-                Files.write(fedizConfig, new String(content).replace("${idp.https.port}", idpHttpsPort).getBytes());
+                Files.write(fedizConfig, new String(content).replace("${idp.https.port}", IDP_HTTPS_PORT).getBytes());
             }
 
             if (!fedizConfigPath.contains("spring")) {
@@ -167,7 +172,7 @@ abstract class AbstractOIDCTest {
 
     protected static void shutdownServer(String servletContextName) throws Exception {
         try {
-            loginToClientsPageAndDeleteClient(rpHttpsPort, idpHttpsPort, servletContextName);
+            loginToClientsPageAndDeleteClient(RP_HTTPS_PORT, IDP_HTTPS_PORT, servletContextName);
         } finally {
             shutdownServer(idpServer);
             shutdownServer(rpServer);
@@ -185,11 +190,11 @@ abstract class AbstractOIDCTest {
     }
 
     private String getIdpHttpsPort() {
-        return idpHttpsPort;
+        return IDP_HTTPS_PORT;
     }
 
     private String getRpHttpsPort() {
-        return rpHttpsPort;
+        return RP_HTTPS_PORT;
     }
 
     protected abstract String getServletContextName();
@@ -1008,7 +1013,7 @@ abstract class AbstractOIDCTest {
     private static String getIdToken(String parentString) {
         String foundString =
             parentString.substring(parentString.indexOf("id_token")
-                                   + ("id_token\":\"").length());
+                                   + "id_token\":\"".length());
         int ampersandIndex = foundString.indexOf('"');
         if (ampersandIndex < 1) {
             ampersandIndex = foundString.length();
@@ -1054,7 +1059,7 @@ abstract class AbstractOIDCTest {
 
         private String code;
 
-        CodeWebConnectionWrapper(WebClient webClient) throws IllegalArgumentException {
+        CodeWebConnectionWrapper(WebClient webClient) {
             super(webClient);
         }
 
diff --git a/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/CXFTest.java b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/CXFTest.java
index 42d7f51..d1f2f0e 100644
--- a/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/CXFTest.java
+++ b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/CXFTest.java
@@ -24,6 +24,14 @@ import java.io.IOException;
 
 import javax.servlet.ServletException;
 
+import com.gargoylesoftware.htmlunit.CookieManager;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.DomElement;
+import com.gargoylesoftware.htmlunit.html.DomNodeList;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
@@ -31,26 +39,19 @@ import org.apache.catalina.startup.Tomcat;
 import org.apache.cxf.fediz.systests.common.AbstractTests;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 
-import com.gargoylesoftware.htmlunit.CookieManager;
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.html.DomElement;
-import com.gargoylesoftware.htmlunit.html.DomNodeList;
-import com.gargoylesoftware.htmlunit.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
-
 /**
  * Some tests for SAML SSO with the CXF plugin, invoking on the Fediz IdP configured for SAML SSO.
  */
 public class CXFTest extends AbstractTests {
 
-    static String idpHttpsPort;
-    static String rpHttpsPort;
+    private static final String IDP_HTTPS_PORT = System.getProperty("idp.https.port");
+    private static final String RP_HTTPS_PORT = System.getProperty("rp.https.port");
 
     private static Tomcat idpServer;
     private static Tomcat rpServer;
@@ -65,13 +66,11 @@ public class CXFTest extends AbstractTests {
 
         System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug");
 
-        idpHttpsPort = System.getProperty("idp.https.port");
-        Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort);
-        rpHttpsPort = System.getProperty("rp.cxf.https.port");
-        Assert.assertNotNull("Property 'rp.cxf.https.port' null", rpHttpsPort);
+        Assert.assertNotNull("Property 'idp.https.port' null", IDP_HTTPS_PORT);
+        Assert.assertNotNull("Property 'rp.cxf.https.port' null", RP_HTTPS_PORT);
 
-        idpServer = startServer(true, idpHttpsPort);
-        rpServer = startServer(false, rpHttpsPort);
+        idpServer = startServer(true, IDP_HTTPS_PORT);
+        rpServer = startServer(false, RP_HTTPS_PORT);
     }
 
     @AfterClass
@@ -146,12 +145,12 @@ public class CXFTest extends AbstractTests {
 
     @Override
     public String getIdpHttpsPort() {
-        return idpHttpsPort;
+        return IDP_HTTPS_PORT;
     }
 
     @Override
     public String getRpHttpsPort() {
-        return rpHttpsPort;
+        return RP_HTTPS_PORT;
     }
 
     @Override
@@ -173,6 +172,7 @@ public class CXFTest extends AbstractTests {
     public void testNoRequestValidation() throws Exception {
 
         String url = "https://localhost:" + getRpHttpsPort() + "/fedizhelloworldcxfnoreqvalidation/secure/fedservlet";
+
         String user = "alice";
         String password = "ecila";
 
diff --git a/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/IdpTest.java b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/IdpTest.java
index aa02e69..5aff4ee 100644
--- a/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/IdpTest.java
+++ b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/IdpTest.java
@@ -26,7 +26,6 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URL;
 import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
 import java.security.PrivateKey;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
@@ -37,6 +36,23 @@ import java.util.UUID;
 
 import javax.servlet.ServletException;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import com.gargoylesoftware.htmlunit.CookieManager;
+import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
+import com.gargoylesoftware.htmlunit.HttpMethod;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.WebRequest;
+import com.gargoylesoftware.htmlunit.html.DomElement;
+import com.gargoylesoftware.htmlunit.html.DomNodeList;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+import com.gargoylesoftware.htmlunit.util.NameValuePair;
+import com.gargoylesoftware.htmlunit.xml.XmlPage;
+
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
@@ -54,14 +70,11 @@ import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.wss4j.common.crypto.Crypto;
 import org.apache.wss4j.common.crypto.CryptoFactory;
 import org.apache.wss4j.common.crypto.CryptoType;
+import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.common.saml.OpenSAMLUtil;
 import org.apache.wss4j.common.util.DOM2Writer;
 import org.apache.wss4j.dom.engine.WSSConfig;
 import org.apache.xml.security.signature.XMLSignature;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
 import org.opensaml.core.xml.XMLObject;
 import org.opensaml.saml.common.SAMLVersion;
 import org.opensaml.saml.common.SignableSAMLObject;
@@ -79,41 +92,33 @@ import org.opensaml.xmlsec.keyinfo.impl.X509KeyInfoGeneratorFactory;
 import org.opensaml.xmlsec.signature.KeyInfo;
 import org.opensaml.xmlsec.signature.Signature;
 import org.opensaml.xmlsec.signature.support.SignatureConstants;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 
-import com.gargoylesoftware.htmlunit.CookieManager;
-import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
-import com.gargoylesoftware.htmlunit.HttpMethod;
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.WebRequest;
-import com.gargoylesoftware.htmlunit.html.DomElement;
-import com.gargoylesoftware.htmlunit.html.DomNodeList;
-import com.gargoylesoftware.htmlunit.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
-import com.gargoylesoftware.htmlunit.util.NameValuePair;
-import com.gargoylesoftware.htmlunit.xml.XmlPage;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
 
 /**
  * Some tests invoking directly on the IdP for SAML SSO
  */
 public class IdpTest {
 
-    static String idpHttpsPort;
-    static String rpHttpsPort;
+    private static final String IDP_HTTPS_PORT = System.getProperty("idp.https.port");
+    private static final String RP_HTTPS_PORT = System.getProperty("rp.https.port");
+
+    private static final String  USER = "alice";
+    private static final String  PWD = "ecila";
 
     private static Tomcat idpServer;
 
     @BeforeClass
     public static void init() throws Exception {
-        idpHttpsPort = System.getProperty("idp.https.port");
-        Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort);
-        rpHttpsPort = System.getProperty("rp.https.port");
-        Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
+        Assert.assertNotNull("Property 'idp.https.port' null", IDP_HTTPS_PORT);
+        Assert.assertNotNull("Property 'rp.https.port' null", RP_HTTPS_PORT);
 
-        idpServer = startServer(idpHttpsPort);
+        idpServer = startServer(IDP_HTTPS_PORT);
 
         WSSConfig.init();
     }
@@ -176,15 +181,15 @@ public class IdpTest {
         }
     }
 
-    public String getIdpHttpsPort() {
-        return idpHttpsPort;
+    static String getIdpHttpsPort() {
+        return IDP_HTTPS_PORT;
     }
 
-    public String getRpHttpsPort() {
-        return rpHttpsPort;
+    static String getRpHttpsPort() {
+        return RP_HTTPS_PORT;
     }
 
-    public String getServletContextName() {
+    static String getServletContextName() {
         return "fedizhelloworld";
     }
 
@@ -212,7 +217,7 @@ public class IdpTest {
         Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
         String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
 
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         String relayState = UUID.randomUUID().toString();
         String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
@@ -264,9 +269,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -276,24 +278,18 @@ public class IdpTest {
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -338,19 +334,16 @@ public class IdpTest {
 
         // Don't inflate the token...
         String requestMessage = DOM2Writer.nodeToString(authnRequestElement);
-        String authnRequestEncoded = Base64Utility.encode(requestMessage.getBytes("UTF-8"));
+        String authnRequestEncoded = Base64Utility.encode(requestMessage.getBytes(UTF_8.name()));
 
         String relayState = UUID.randomUUID().toString();
         String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up";
 
-        String user = "alice";
-        String password = "ecila";
-
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
 
@@ -388,9 +381,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -399,10 +389,9 @@ public class IdpTest {
             );
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         String relayState = UUID.randomUUID().toString();
 
@@ -418,29 +407,25 @@ public class IdpTest {
         java.security.Signature signature = java.security.Signature.getInstance("SHA1withRSA");
         signature.initSign(privateKey);
 
-        String requestToSign = SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        requestToSign += "&" + SSOConstants.RELAY_STATE + "=" + relayState;
-        requestToSign += "&" + SSOConstants.SIG_ALG + "="
-            + URLEncoder.encode(SSOConstants.RSA_SHA1, StandardCharsets.UTF_8.name());
+        String requestToSign = SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest
+                + "&" + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SIG_ALG + "=" + URLEncoder.encode(SSOConstants.RSA_SHA1, UTF_8.name());
 
-        signature.update(requestToSign.getBytes(StandardCharsets.UTF_8));
+        signature.update(requestToSign.getBytes(UTF_8));
         byte[] signBytes = signature.sign();
 
         String encodedSignature = Base64.getEncoder().encodeToString(signBytes);
 
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        url += "&" + SSOConstants.SIGNATURE + "=" + URLEncoder.encode(encodedSignature, StandardCharsets.UTF_8.name());
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?"
+            + SSOConstants.RELAY_STATE + "=" + relayState
+            + "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest
+            + "&" + SSOConstants.SIGNATURE + "=" + URLEncoder.encode(encodedSignature, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -469,9 +454,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -480,10 +462,9 @@ public class IdpTest {
             );
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         String relayState = UUID.randomUUID().toString();
 
@@ -499,31 +480,28 @@ public class IdpTest {
         java.security.Signature signature = java.security.Signature.getInstance("SHA256withRSA");
         signature.initSign(privateKey);
 
-        String requestToSign = SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        requestToSign += "&" + SSOConstants.RELAY_STATE + "=" + relayState;
         String encodedSignatureAlgorithm =
-            URLEncoder.encode("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", StandardCharsets.UTF_8.name());
-        requestToSign += "&" + SSOConstants.SIG_ALG + "=" + encodedSignatureAlgorithm;
+                URLEncoder.encode("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", UTF_8.name());
+        String requestToSign = SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest
+                + "&" + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SIG_ALG + "=" + encodedSignatureAlgorithm;
 
-        signature.update(requestToSign.getBytes(StandardCharsets.UTF_8));
+        signature.update(requestToSign.getBytes(UTF_8));
         byte[] signBytes = signature.sign();
 
         String encodedSignature = Base64.getEncoder().encodeToString(signBytes);
 
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        url += "&" + SSOConstants.SIG_ALG + "=" + encodedSignatureAlgorithm;
-        url += "&" + SSOConstants.SIGNATURE + "=" + URLEncoder.encode(encodedSignature, StandardCharsets.UTF_8.name());
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest
+                + "&" + SSOConstants.SIG_ALG + "=" + encodedSignatureAlgorithm
+                + "&" + SSOConstants.SIGNATURE + "=" + URLEncoder.encode(encodedSignature, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -552,9 +530,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -564,23 +539,17 @@ public class IdpTest {
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.addRequestHeader("Authorization", "Basic "
-            + Base64.getEncoder().encodeToString((user + ":" + password).getBytes(StandardCharsets.UTF_8)));
+            + Base64.getEncoder().encodeToString((USER + ":" + PWD).getBytes(UTF_8)));
 
         //
         // First invocation
@@ -611,7 +580,7 @@ public class IdpTest {
 
         webClient.removeRequestHeader("Authorization");
         webClient.addRequestHeader("Authorization", "Basic "
-            + Base64.getEncoder().encodeToString(("mallory" + ":" + password).getBytes(StandardCharsets.UTF_8)));
+            + Base64.getEncoder().encodeToString(("mallory" + ":" + PWD).getBytes(UTF_8)));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         idpPage = webClient.getPage(url);
@@ -639,9 +608,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -652,18 +618,12 @@ public class IdpTest {
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         CookieManager cookieManager = new CookieManager();
@@ -671,7 +631,7 @@ public class IdpTest {
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         //
         // First invocation
@@ -745,9 +705,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -757,10 +714,9 @@ public class IdpTest {
         authnRequest.setForceAuthn(Boolean.TRUE);
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         String relayState = UUID.randomUUID().toString();
 
@@ -776,23 +732,19 @@ public class IdpTest {
         java.security.Signature signature = java.security.Signature.getInstance("SHA1withRSA");
         signature.initSign(privateKey);
 
-        String requestToSign = SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        requestToSign += "&" + SSOConstants.RELAY_STATE + "=" + relayState;
-        requestToSign += "&" + SSOConstants.SIG_ALG + "="
-            + URLEncoder.encode(SSOConstants.RSA_SHA1, StandardCharsets.UTF_8.name());
+        String requestToSign = SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest
+                + "&" + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SIG_ALG + "=" + URLEncoder.encode(SSOConstants.RSA_SHA1, UTF_8.name());
 
-        signature.update(requestToSign.getBytes(StandardCharsets.UTF_8));
+        signature.update(requestToSign.getBytes(UTF_8));
         byte[] signBytes = signature.sign();
 
         String encodedSignature = Base64.getEncoder().encodeToString(signBytes);
 
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        url += "&" + SSOConstants.SIGNATURE + "=" + URLEncoder.encode(encodedSignature, StandardCharsets.UTF_8.name());
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest
+                + "&" + SSOConstants.SIGNATURE + "=" + URLEncoder.encode(encodedSignature, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         CookieManager cookieManager = new CookieManager();
@@ -800,7 +752,7 @@ public class IdpTest {
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         //
         // First invocation
@@ -878,9 +830,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -890,24 +839,18 @@ public class IdpTest {
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -925,9 +868,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -937,24 +877,18 @@ public class IdpTest {
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -972,9 +906,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
 
@@ -1012,24 +943,18 @@ public class IdpTest {
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -1047,9 +972,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -1058,24 +980,18 @@ public class IdpTest {
             );
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -1093,9 +1009,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -1105,22 +1018,16 @@ public class IdpTest {
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
-
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         try {
@@ -1138,9 +1045,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -1149,24 +1053,18 @@ public class IdpTest {
             );
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -1184,9 +1082,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -1195,26 +1090,20 @@ public class IdpTest {
             );
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
 
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        url += "&" + SSOConstants.SIGNATURE + "=";
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name())
+                + "&" + SSOConstants.SIGNATURE + "=";
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -1232,9 +1121,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -1243,10 +1129,9 @@ public class IdpTest {
             );
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         String relayState = UUID.randomUUID().toString();
 
@@ -1262,30 +1147,25 @@ public class IdpTest {
         java.security.Signature signature = java.security.Signature.getInstance("SHA1withRSA");
         signature.initSign(privateKey);
 
-        String requestToSign = SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        requestToSign += "&" + SSOConstants.RELAY_STATE + "=" + relayState;
-        requestToSign += "&" + SSOConstants.SIG_ALG + "="
-            + URLEncoder.encode(SSOConstants.RSA_SHA1, StandardCharsets.UTF_8.name());
+        String requestToSign = SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest
+                + "&" + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SIG_ALG + "=" + URLEncoder.encode(SSOConstants.RSA_SHA1, UTF_8.name());
 
-        signature.update(requestToSign.getBytes(StandardCharsets.UTF_8));
+        signature.update(requestToSign.getBytes(UTF_8));
         byte[] signBytes = signature.sign();
 
         String encodedSignature = Base64.getEncoder().encodeToString(signBytes);
 
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        url += "&" + SSOConstants.SIGNATURE + "=" + URLEncoder.encode(encodedSignature, StandardCharsets.UTF_8.name());
-        url += "-xyz";
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest
+                + "&" + SSOConstants.SIGNATURE + "=" + URLEncoder.encode(encodedSignature, UTF_8.name()) + "-xyz";
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -1303,9 +1183,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -1314,10 +1191,9 @@ public class IdpTest {
             );
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         String relayState = UUID.randomUUID().toString();
 
@@ -1333,12 +1209,11 @@ public class IdpTest {
         java.security.Signature signature = java.security.Signature.getInstance("SHA1withRSA");
         signature.initSign(privateKey);
 
-        String requestToSign = SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        requestToSign += "&" + SSOConstants.RELAY_STATE + "=" + relayState;
-        requestToSign += "&" + SSOConstants.SIG_ALG + "="
-            + URLEncoder.encode(SSOConstants.RSA_SHA1, StandardCharsets.UTF_8.name());
+        String requestToSign = SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest
+                + "&" + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SIG_ALG + "=" + URLEncoder.encode(SSOConstants.RSA_SHA1, UTF_8.name());
 
-        signature.update(requestToSign.getBytes(StandardCharsets.UTF_8));
+        signature.update(requestToSign.getBytes(UTF_8));
         byte[] signBytes = signature.sign();
         if (signBytes[1] != (byte)1) {
             signBytes[1] = (byte)1;
@@ -1348,19 +1223,16 @@ public class IdpTest {
 
         String encodedSignature = Base64.getEncoder().encodeToString(signBytes);
 
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        url += "&" + SSOConstants.SIGNATURE + "=" + URLEncoder.encode(encodedSignature, StandardCharsets.UTF_8.name());
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest
+                + "&" + SSOConstants.SIGNATURE + "=" + URLEncoder.encode(encodedSignature, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -1378,9 +1250,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -1389,10 +1258,9 @@ public class IdpTest {
             );
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         String relayState = UUID.randomUUID().toString();
 
@@ -1408,30 +1276,25 @@ public class IdpTest {
         java.security.Signature signature = java.security.Signature.getInstance("SHA1withRSA");
         signature.initSign(privateKey);
 
-        String requestToSign = SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        requestToSign += "&" + SSOConstants.RELAY_STATE + "=" + relayState;
-        requestToSign += "&" + SSOConstants.SIG_ALG + "="
-            + URLEncoder.encode(SSOConstants.RSA_SHA1, StandardCharsets.UTF_8.name())
-            + "asf=xyz";
+        String requestToSign = SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest
+                + "&" + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SIG_ALG + "=" + URLEncoder.encode(SSOConstants.RSA_SHA1, UTF_8.name()) + "asf=xyz";
 
-        signature.update(requestToSign.getBytes(StandardCharsets.UTF_8));
+        signature.update(requestToSign.getBytes(UTF_8));
         byte[] signBytes = signature.sign();
 
         String encodedSignature = Base64.getEncoder().encodeToString(signBytes);
 
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-        url += "&" + SSOConstants.SIGNATURE + "=" + URLEncoder.encode(encodedSignature, StandardCharsets.UTF_8.name());
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml/up?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest
+                + "&" + SSOConstants.SIGNATURE + "=" + URLEncoder.encode(encodedSignature, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -1449,9 +1312,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/insecure/fedservlet";
         AuthnRequest authnRequest =
@@ -1461,24 +1321,18 @@ public class IdpTest {
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage idpPage = webClient.getPage(url);
@@ -1512,23 +1366,18 @@ public class IdpTest {
 
         // Don't inflate the token...
         String requestMessage = DOM2Writer.nodeToString(authnRequestElement);
-        String authnRequestEncoded = Base64Utility.encode(requestMessage.getBytes(StandardCharsets.UTF_8));
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = Base64Utility.encode(requestMessage.getBytes(UTF_8));
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         try {
@@ -1546,9 +1395,6 @@ public class IdpTest {
         OpenSAMLUtil.initSamlEngine();
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -1559,23 +1405,17 @@ public class IdpTest {
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.addRequestHeader("Authorization", "Basic "
-            + Base64.getEncoder().encodeToString((user + ":" + password).getBytes(StandardCharsets.UTF_8)));
+            + Base64.getEncoder().encodeToString((USER + ":" + PWD).getBytes(UTF_8)));
 
         //
         // First invocation
@@ -1606,7 +1446,7 @@ public class IdpTest {
 
         webClient.removeRequestHeader("Authorization");
         webClient.addRequestHeader("Authorization", "Basic "
-            + Base64.getEncoder().encodeToString(("mallory" + ":" + password).getBytes(StandardCharsets.UTF_8)));
+            + Base64.getEncoder().encodeToString(("mallory" + ":" + PWD).getBytes(UTF_8)));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         try {
@@ -1626,9 +1466,6 @@ public class IdpTest {
         // 1. First let's login to the IdP
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -1638,18 +1475,12 @@ public class IdpTest {
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         CookieManager cookieManager = new CookieManager();
 
@@ -1658,7 +1489,7 @@ public class IdpTest {
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         HtmlPage idpPage = webClient.getPage(url);
@@ -1678,9 +1509,6 @@ public class IdpTest {
         // 2. now we logout from IdP
 
         // Create SAML LogoutRequest
-        doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-
         Issuer issuer = SamlpRequestComponentBuilder.createIssuer("urn:org:apache:cxf:fediz:fedizhelloworld");
         String destination = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml";
         LogoutRequest logoutRequest =
@@ -1689,22 +1517,19 @@ public class IdpTest {
 
         signAuthnRequest(logoutRequest);
 
-        Element logoutRequestElement = OpenSAMLUtil.toDom(logoutRequest, doc);
-        String logoutRequestEncoded = encodeAuthnRequest(logoutRequestElement);
-
-        urlEncodedRequest = URLEncoder.encode(logoutRequestEncoded, "UTF-8");
+        String logoutRequestEncoded = encodeAuthnRequest(logoutRequest);
 
         relayState = UUID.randomUUID().toString();
-        String logoutURL = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        logoutURL += SSOConstants.RELAY_STATE + "=" + relayState;
-        logoutURL += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
+        String logoutURL = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(logoutRequestEncoded, UTF_8.name());
 
         webClient = new WebClient();
         webClient.setCookieManager(cookieManager);
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         idpPage = webClient.getPage(logoutURL);
@@ -1727,7 +1552,7 @@ public class IdpTest {
 
         byte[] deflatedToken = Base64Utility.decode(responseValue);
         InputStream tokenStream = new ByteArrayInputStream(deflatedToken);
-        Document responseDoc = StaxUtils.read(new InputStreamReader(tokenStream, StandardCharsets.UTF_8));
+        Document responseDoc = StaxUtils.read(new InputStreamReader(tokenStream, UTF_8));
 
         LogoutResponse logoutResponse = (LogoutResponse)OpenSAMLUtil.fromDom(responseDoc.getDocumentElement());
         Assert.assertNotNull(logoutResponse);
@@ -1761,9 +1586,6 @@ public class IdpTest {
         // 1. First let's login to the IdP
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -1773,18 +1595,12 @@ public class IdpTest {
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         CookieManager cookieManager = new CookieManager();
 
@@ -1793,7 +1609,7 @@ public class IdpTest {
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         HtmlPage idpPage = webClient.getPage(url);
@@ -1813,9 +1629,6 @@ public class IdpTest {
         // 2. now we logout from IdP
 
         // Create SAML LogoutRequest
-        doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-
         Issuer issuer = SamlpRequestComponentBuilder.createIssuer("urn:org:apache:cxf:fediz:fedizhelloworld");
         String destination = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml";
         Date now = new Date();
@@ -1826,22 +1639,19 @@ public class IdpTest {
 
         signAuthnRequest(logoutRequest);
 
-        Element logoutRequestElement = OpenSAMLUtil.toDom(logoutRequest, doc);
-        String logoutRequestEncoded = encodeAuthnRequest(logoutRequestElement);
-
-        urlEncodedRequest = URLEncoder.encode(logoutRequestEncoded, "UTF-8");
+        String logoutRequestEncoded = encodeAuthnRequest(logoutRequest);
 
         relayState = UUID.randomUUID().toString();
-        String logoutURL = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        logoutURL += SSOConstants.RELAY_STATE + "=" + relayState;
-        logoutURL += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
+        String logoutURL = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(logoutRequestEncoded, UTF_8.name());
 
         webClient = new WebClient();
         webClient.setCookieManager(cookieManager);
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         idpPage = webClient.getPage(logoutURL);
@@ -1858,7 +1668,7 @@ public class IdpTest {
 
         byte[] deflatedToken = Base64Utility.decode(responseValue);
         InputStream tokenStream = new ByteArrayInputStream(deflatedToken);
-        Document responseDoc = StaxUtils.read(new InputStreamReader(tokenStream, StandardCharsets.UTF_8));
+        Document responseDoc = StaxUtils.read(new InputStreamReader(tokenStream, UTF_8));
 
         LogoutResponse logoutResponse = (LogoutResponse)OpenSAMLUtil.fromDom(responseDoc.getDocumentElement());
         Assert.assertNotNull(logoutResponse);
@@ -1891,9 +1701,6 @@ public class IdpTest {
         // 1. First let's login to the IdP
 
         // Create SAML AuthnRequest
-        Document doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-        // Create the AuthnRequest
         String consumerURL = "https://localhost:" + getRpHttpsPort() + "/"
             + getServletContextName() + "/secure/fedservlet";
         AuthnRequest authnRequest =
@@ -1903,18 +1710,12 @@ public class IdpTest {
         authnRequest.setDestination("https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml");
         signAuthnRequest(authnRequest);
 
-        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
-        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
-
-        String urlEncodedRequest = URLEncoder.encode(authnRequestEncoded, "UTF-8");
+        String authnRequestEncoded = encodeAuthnRequest(authnRequest);
 
         String relayState = UUID.randomUUID().toString();
-        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
-        url += SSOConstants.RELAY_STATE + "=" + relayState;
-        url += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
-
-        String user = "alice";
-        String password = "ecila";
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?"
+                + SSOConstants.RELAY_STATE + "=" + relayState
+                + "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(authnRequestEncoded, UTF_8.name());
 
         CookieManager cookieManager = new CookieManager();
 
@@ -1923,7 +1724,7 @@ public class IdpTest {
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         HtmlPage idpPage = webClient.getPage(url);
@@ -1943,9 +1744,6 @@ public class IdpTest {
         // 2. now we logout from IdP - but cancel the logout
 
         // Create SAML LogoutRequest
-        doc = DOMUtils.createDocument();
-        doc.appendChild(doc.createElement("root"));
-
         Issuer issuer = SamlpRequestComponentBuilder.createIssuer("urn:org:apache:cxf:fediz:fedizhelloworld");
         String destination = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml";
         LogoutRequest logoutRequest =
@@ -1954,22 +1752,19 @@ public class IdpTest {
 
         signAuthnRequest(logoutRequest);
 
-        Element logoutRequestElement = OpenSAMLUtil.toDom(logoutRequest, doc);
-        String logoutRequestEncoded = encodeAuthnRequest(logoutRequestElement);
-
-        urlEncodedRequest = URLEncoder.encode(logoutRequestEncoded, "UTF-8");
+        String logoutRequestEncoded = encodeAuthnRequest(logoutRequest);
 
         relayState = UUID.randomUUID().toString();
         String logoutURL = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/saml?";
         logoutURL += SSOConstants.RELAY_STATE + "=" + relayState;
-        logoutURL += "&" + SSOConstants.SAML_REQUEST + "=" + urlEncodedRequest;
+        logoutURL += "&" + SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(logoutRequestEncoded, UTF_8.name());
 
         webClient = new WebClient();
         webClient.setCookieManager(cookieManager);
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
             new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
+            new UsernamePasswordCredentials(USER, PWD));
 
         webClient.getOptions().setJavaScriptEnabled(false);
         idpPage = webClient.getPage(logoutURL);
@@ -1992,7 +1787,7 @@ public class IdpTest {
 
         byte[] deflatedToken = Base64Utility.decode(responseValue);
         InputStream tokenStream = new ByteArrayInputStream(deflatedToken);
-        Document responseDoc = StaxUtils.read(new InputStreamReader(tokenStream, StandardCharsets.UTF_8));
+        Document responseDoc = StaxUtils.read(new InputStreamReader(tokenStream, UTF_8));
 
         LogoutResponse logoutResponse = (LogoutResponse)OpenSAMLUtil.fromDom(responseDoc.getDocumentElement());
         Assert.assertNotNull(logoutResponse);
@@ -2018,16 +1813,18 @@ public class IdpTest {
         webClient.close();
     }
 
-    private String encodeAuthnRequest(Element authnRequest) throws IOException {
-        String requestMessage = DOM2Writer.nodeToString(authnRequest);
+    private static String encodeAuthnRequest(XMLObject request) throws WSSecurityException {
+        Document doc = DOMUtils.createDocument();
+        doc.appendChild(doc.createElement("root"));
+        String requestMessage = DOM2Writer.nodeToString(OpenSAMLUtil.toDom(request, doc));
 
         DeflateEncoderDecoder encoder = new DeflateEncoderDecoder();
-        byte[] deflatedBytes = encoder.deflateToken(requestMessage.getBytes(StandardCharsets.UTF_8));
+        byte[] deflatedBytes = encoder.deflateToken(requestMessage.getBytes(UTF_8));
 
         return Base64Utility.encode(deflatedBytes);
     }
 
-    private void signAuthnRequest(SignableSAMLObject signableObject) throws Exception {
+    private static void signAuthnRequest(SignableSAMLObject signableObject) throws Exception {
         Crypto crypto = CryptoFactory.getInstance("stsKeystoreA.properties");
 
         CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
@@ -2065,7 +1862,7 @@ public class IdpTest {
 
     }
 
-    private org.opensaml.saml.saml2.core.Response parseSAMLResponse(HtmlPage idpPage,
+    private static org.opensaml.saml.saml2.core.Response parseSAMLResponse(HtmlPage idpPage,
                                                                     String relayState,
                                                                     String consumerURL,
                                                                     String authnRequestId
@@ -2101,7 +1898,7 @@ public class IdpTest {
         byte[] deflatedToken = Base64Utility.decode(samlResponse);
         InputStream inputStream = new ByteArrayInputStream(deflatedToken);
 
-        Document responseDoc = StaxUtils.read(new InputStreamReader(inputStream, "UTF-8"));
+        Document responseDoc = StaxUtils.read(new InputStreamReader(inputStream, UTF_8.name()));
 
         XMLObject responseObject = OpenSAMLUtil.fromDom(responseDoc.getDocumentElement());
         Assert.assertTrue(responseObject instanceof org.opensaml.saml.saml2.core.Response);
diff --git a/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/JettyTest.java b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/JettyTest.java
index 0e2096f..a4433e2 100644
--- a/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/JettyTest.java
+++ b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/JettyTest.java
@@ -25,6 +25,7 @@ import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.cxf.fediz.systests.common.AbstractTests;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -35,17 +36,15 @@ import org.junit.Ignore;
  */
 public class JettyTest extends AbstractTests {
 
-    static String idpHttpsPort;
-    static String rpHttpsPort;
+    private static final String IDP_HTTPS_PORT = System.getProperty("idp.https.port");
+    private static final String RP_HTTPS_PORT = System.getProperty("rp.jetty.https.port");
 
     private static Tomcat idpServer;
 
     @BeforeClass
     public static void init() {
-        idpHttpsPort = System.getProperty("idp.https.port");
-        Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort);
-        rpHttpsPort = System.getProperty("rp.jetty.https.port");
-        Assert.assertNotNull("Property 'rp.jetty.https.port' null", rpHttpsPort);
+        Assert.assertNotNull("Property 'idp.https.port' null", IDP_HTTPS_PORT);
+        Assert.assertNotNull("Property 'rp.jetty.https.port' null", RP_HTTPS_PORT);
 
         initIdp();
 
@@ -83,7 +82,7 @@ public class JettyTest extends AbstractTests {
             idpServer.getHost().setDeployOnStartup(true);
 
             Connector httpsConnector = new Connector();
-            httpsConnector.setPort(Integer.parseInt(idpHttpsPort));
+            httpsConnector.setPort(Integer.parseInt(IDP_HTTPS_PORT));
             httpsConnector.setSecure(true);
             httpsConnector.setScheme("https");
             httpsConnector.setAttribute("keyAlias", "mytomidpkey");
@@ -112,12 +111,12 @@ public class JettyTest extends AbstractTests {
 
     @Override
     public String getIdpHttpsPort() {
-        return idpHttpsPort;
+        return IDP_HTTPS_PORT;
     }
 
     @Override
     public String getRpHttpsPort() {
-        return rpHttpsPort;
+        return RP_HTTPS_PORT;
     }
 
     @Override
diff --git a/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/SpringTest.java b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/SpringTest.java
index 0f1c2a8..ce6a4ee 100644
--- a/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/SpringTest.java
+++ b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/SpringTest.java
@@ -24,6 +24,14 @@ import java.io.IOException;
 
 import javax.servlet.ServletException;
 
+import com.gargoylesoftware.htmlunit.CookieManager;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.DomElement;
+import com.gargoylesoftware.htmlunit.html.DomNodeList;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
@@ -31,26 +39,19 @@ import org.apache.catalina.startup.Tomcat;
 import org.apache.cxf.fediz.systests.common.AbstractTests;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 
-import com.gargoylesoftware.htmlunit.CookieManager;
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.html.DomElement;
-import com.gargoylesoftware.htmlunit.html.DomNodeList;
-import com.gargoylesoftware.htmlunit.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
-
 /**
  * Some tests for SAML SSO with the Spring (4) plugin, invoking on the Fediz IdP configured for SAML SSO.
  */
 public class SpringTest extends AbstractTests {
 
-    static String idpHttpsPort;
-    static String rpHttpsPort;
+    private static final String IDP_HTTPS_PORT = System.getProperty("idp.https.port");
+    private static final String RP_HTTPS_PORT = System.getProperty("rp.https.port");
 
     private static Tomcat idpServer;
     private static Tomcat rpServer;
@@ -65,13 +66,11 @@ public class SpringTest extends AbstractTests {
 
         System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug");
 
-        idpHttpsPort = System.getProperty("idp.https.port");
-        Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort);
-        rpHttpsPort = System.getProperty("rp.spring.https.port");
-        Assert.assertNotNull("Property 'rp.spring.https.port' null", rpHttpsPort);
+        Assert.assertNotNull("Property 'idp.https.port' null", IDP_HTTPS_PORT);
+        Assert.assertNotNull("Property 'rp.spring.https.port' null", RP_HTTPS_PORT);
 
-        idpServer = startServer(true, idpHttpsPort);
-        rpServer = startServer(false, rpHttpsPort);
+        idpServer = startServer(true, IDP_HTTPS_PORT);
+        rpServer = startServer(false, RP_HTTPS_PORT);
     }
 
     @AfterClass
@@ -146,12 +145,12 @@ public class SpringTest extends AbstractTests {
 
     @Override
     public String getIdpHttpsPort() {
-        return idpHttpsPort;
+        return IDP_HTTPS_PORT;
     }
 
     @Override
     public String getRpHttpsPort() {
-        return rpHttpsPort;
+        return RP_HTTPS_PORT;
     }
 
     @Override
@@ -194,7 +193,8 @@ public class SpringTest extends AbstractTests {
     @org.junit.Test
     public void testNoRequestValidation() throws Exception {
 
-        String url = "https://localhost:" + getRpHttpsPort() + "/fedizhelloworldspringnoreqvalidation/secure/fedservlet";
+        String url = "https://localhost:" + getRpHttpsPort()
+                + "/fedizhelloworldspringnoreqvalidation/secure/fedservlet";
         String user = "alice";
         String password = "ecila";
 
diff --git a/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/Tomcat8PluginTest.java b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/TomcatPluginTest.java
similarity index 94%
rename from systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/Tomcat8PluginTest.java
rename to systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/TomcatPluginTest.java
index e57c910..d67a08b 100644
--- a/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/Tomcat8PluginTest.java
+++ b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/TomcatPluginTest.java
@@ -28,6 +28,18 @@ import java.nio.file.Files;
 
 import javax.servlet.ServletException;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+import com.gargoylesoftware.htmlunit.CookieManager;
+import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.DomElement;
+import com.gargoylesoftware.htmlunit.html.DomNodeList;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
 import org.apache.catalina.Context;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
@@ -40,42 +52,29 @@ import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.wss4j.common.util.DOM2Writer;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import com.gargoylesoftware.htmlunit.CookieManager;
-import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.html.DomElement;
-import com.gargoylesoftware.htmlunit.html.DomNodeList;
-import com.gargoylesoftware.htmlunit.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
-
 /**
- * Some tests for SAML SSO with the Tomcat 8 plugin, invoking on the Fediz IdP configured for SAML SSO.
+ * Some tests for SAML SSO with the Tomcat plugin, invoking on the Fediz IdP configured for SAML SSO.
  */
-public class Tomcat8PluginTest extends AbstractTests {
+public class TomcatPluginTest extends AbstractTests {
 
-    static String idpHttpsPort;
-    static String rpHttpsPort;
+    private static final String IDP_HTTPS_PORT = System.getProperty("idp.https.port");
+    private static final String RP_HTTPS_PORT = System.getProperty("rp.https.port");
 
     private static Tomcat idpServer;
     private static Tomcat rpServer;
 
     @BeforeClass
     public static void init() throws Exception {
-        idpHttpsPort = System.getProperty("idp.https.port");
-        Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort);
-        rpHttpsPort = System.getProperty("rp.https.port");
-        Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
+        Assert.assertNotNull("Property 'idp.https.port' null", IDP_HTTPS_PORT);
+        Assert.assertNotNull("Property 'rp.https.port' null", RP_HTTPS_PORT);
 
-        idpServer = startServer(true, idpHttpsPort);
-        rpServer = startServer(false, rpHttpsPort);
+        idpServer = startServer(true, IDP_HTTPS_PORT);
+        rpServer = startServer(false, RP_HTTPS_PORT);
     }
 
     private static Tomcat startServer(boolean idp, String port)
@@ -125,7 +124,7 @@ public class Tomcat8PluginTest extends AbstractTests {
             File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
             String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             if (content.contains("idp.https.port")) {
-                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
+                content = content.replaceAll("\\$\\{idp.https.port\\}", IDP_HTTPS_PORT);
 
                 File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
                 Files.write(f2.toPath(), content.getBytes());
@@ -164,12 +163,12 @@ public class Tomcat8PluginTest extends AbstractTests {
 
     @Override
     public String getIdpHttpsPort() {
-        return idpHttpsPort;
+        return IDP_HTTPS_PORT;
     }
 
     @Override
     public String getRpHttpsPort() {
-        return rpHttpsPort;
+        return RP_HTTPS_PORT;
     }
 
     @Override
diff --git a/systests/spring/src/test/java/org/apache/cxf/fediz/systests/spring/SpringTest.java b/systests/spring/src/test/java/org/apache/cxf/fediz/systests/spring/SpringTest.java
index 6ad5d12..39c5d2a 100644
--- a/systests/spring/src/test/java/org/apache/cxf/fediz/systests/spring/SpringTest.java
+++ b/systests/spring/src/test/java/org/apache/cxf/fediz/systests/spring/SpringTest.java
@@ -24,6 +24,14 @@ import java.io.IOException;
 
 import javax.servlet.ServletException;
 
+import com.gargoylesoftware.htmlunit.CookieManager;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.DomElement;
+import com.gargoylesoftware.htmlunit.html.DomNodeList;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
@@ -31,19 +39,12 @@ import org.apache.catalina.startup.Tomcat;
 import org.apache.cxf.fediz.systests.common.AbstractTests;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 
-import com.gargoylesoftware.htmlunit.CookieManager;
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.html.DomElement;
-import com.gargoylesoftware.htmlunit.html.DomNodeList;
-import com.gargoylesoftware.htmlunit.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
-
 public class SpringTest extends AbstractTests {
 
     static String idpHttpsPort;
@@ -173,7 +174,8 @@ public class SpringTest extends AbstractTests {
     @org.junit.Test
     public void testNoRequestValidation() throws Exception {
 
-        String url = "https://localhost:" + getRpHttpsPort() + "/fedizhelloworldspringnoreqvalidation/secure/fedservlet";
+        String url = "https://localhost:" + getRpHttpsPort()
+            + "/fedizhelloworldspringnoreqvalidation/secure/fedservlet";
         String user = "alice";
         String password = "ecila";
 
diff --git a/systests/spring/src/test/java/org/apache/cxf/fediz/systests/spring/TokenExpiryTest.java b/systests/spring/src/test/java/org/apache/cxf/fediz/systests/spring/TokenExpiryTest.java
index bff87c8..76932a5 100644
--- a/systests/spring/src/test/java/org/apache/cxf/fediz/systests/spring/TokenExpiryTest.java
+++ b/systests/spring/src/test/java/org/apache/cxf/fediz/systests/spring/TokenExpiryTest.java
@@ -30,6 +30,7 @@ import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.cxf.fediz.systests.common.AbstractExpiryTests;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
diff --git a/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractClientCertTests.java b/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractClientCertTests.java
index 0f3aab8..0f4e5e6 100644
--- a/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractClientCertTests.java
+++ b/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractClientCertTests.java
@@ -36,6 +36,7 @@ import com.gargoylesoftware.htmlunit.util.NameValuePair;
 
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.wss4j.dom.engine.WSSConfig;
+
 import org.junit.Assert;
 
 public abstract class AbstractClientCertTests {
diff --git a/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractExpiryTests.java b/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractExpiryTests.java
index 3025696..c16498a 100644
--- a/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractExpiryTests.java
+++ b/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractExpiryTests.java
@@ -28,6 +28,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.wss4j.dom.engine.WSSConfig;
+
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -117,7 +118,8 @@ public abstract class AbstractExpiryTests {
         CookieManager cookieManager = new CookieManager();
 
         // 1. Login
-        HTTPTestUtils.loginWithCookieManager(url, user, password, getIdpHttpsPort(), "signinresponseform", cookieManager);
+        HTTPTestUtils.loginWithCookieManager(url, user, password, getIdpHttpsPort(), "signinresponseform",
+                cookieManager);
 
         // 2. Sign out of the service (but not the Idp)
         final WebClient webClient = new WebClient();
@@ -127,7 +129,8 @@ public abstract class AbstractExpiryTests {
         webClient.close();
 
         // 3. Sign back in to the service provider. This time it will get a new IdP token due to wfresh=0.
-        HTTPTestUtils.loginWithCookieManager(url, user, password, getIdpHttpsPort(), "signinresponseform", cookieManager);
+        HTTPTestUtils.loginWithCookieManager(url, user, password, getIdpHttpsPort(), "signinresponseform",
+                cookieManager);
     }
 
     private void verifyApplication(String user, String bodyTextContent) {
diff --git a/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractTests.java b/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractTests.java
index 5880438..02bb2d1 100644
--- a/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractTests.java
+++ b/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractTests.java
@@ -55,6 +55,7 @@ import org.apache.wss4j.common.util.DOM2Writer;
 import org.apache.wss4j.dom.engine.WSSConfig;
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.signature.XMLSignature;
+
 import org.junit.Assert;
 import org.junit.Test;
 
diff --git a/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/HTTPTestUtils.java b/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/HTTPTestUtils.java
index 46103cb..4a839da 100644
--- a/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/HTTPTestUtils.java
+++ b/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/HTTPTestUtils.java
@@ -31,6 +31,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
 
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
+
 import org.junit.Assert;
 
 /**
@@ -66,8 +67,8 @@ public final class HTTPTestUtils {
         return rpPage.getBody().getTextContent();
     }
 
-    public static String loginWithCookieManager(String url, String user, String password,
-                                                String idpPort, String formName, CookieManager cookieManager) throws IOException {
+    public static String loginWithCookieManager(String url, String user, String password, String idpPort,
+            String formName, CookieManager cookieManager) throws IOException {
         final WebClient webClient = new WebClient();
         webClient.setCookieManager(cookieManager);
         webClient.getOptions().setUseInsecureSSL(true);
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/AudienceRestrictionTest.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/AudienceRestrictionTest.java
index 64b9006..d4e8fe6 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/AudienceRestrictionTest.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/AudienceRestrictionTest.java
@@ -20,18 +20,19 @@
 package org.apache.cxf.fediz.systests.tomcat;
 
 
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-
 import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
 import com.gargoylesoftware.htmlunit.WebClient;
 import com.gargoylesoftware.htmlunit.html.HtmlForm;
 import com.gargoylesoftware.htmlunit.html.HtmlPage;
 import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
 
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
 /**
  * A test to make sure that audience restriction validation is working correctly in the plugin.
  */
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/ClientCertificateTest.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/ClientCertificateTest.java
index 2419ea6..ddcd71b 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/ClientCertificateTest.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/ClientCertificateTest.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.fediz.systests.tomcat;
 
 import org.apache.cxf.fediz.systests.common.AbstractClientCertTests;
+
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/HolderOfKeyTest.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/HolderOfKeyTest.java
index 8870a6a..579c19c 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/HolderOfKeyTest.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/HolderOfKeyTest.java
@@ -19,13 +19,6 @@
 
 package org.apache.cxf.fediz.systests.tomcat;
 
-import org.apache.cxf.fediz.core.ClaimTypes;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-
 import com.gargoylesoftware.htmlunit.WebClient;
 import com.gargoylesoftware.htmlunit.html.DomElement;
 import com.gargoylesoftware.htmlunit.html.DomNodeList;
@@ -33,6 +26,14 @@ import com.gargoylesoftware.htmlunit.html.HtmlForm;
 import com.gargoylesoftware.htmlunit.html.HtmlPage;
 import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
 
+import org.apache.cxf.fediz.core.ClaimTypes;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
 /**
  * A test for sending a "PublicKey" KeyType request to the IdP via the "wreq" parameter. This
  * will cause the IdP/STS to issue a "HolderOfKey" SAML Assertion.
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TokenExpiryTest.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TokenExpiryTest.java
index 1274159..58f8d44 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TokenExpiryTest.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TokenExpiryTest.java
@@ -21,6 +21,7 @@ package org.apache.cxf.fediz.systests.tomcat;
 
 
 import org.apache.cxf.fediz.systests.common.AbstractExpiryTests;
+
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TomcatLauncher.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TomcatLauncher.java
index 465e5b6..2f0d7c2 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TomcatLauncher.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TomcatLauncher.java
@@ -20,8 +20,6 @@
 package org.apache.cxf.fediz.systests.tomcat;
 
 
-import static org.junit.Assert.assertNotNull;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Files;
@@ -37,20 +35,22 @@ import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
 
-public class TomcatLauncher {
+import static org.junit.Assert.assertNotNull;
+
+public abstract class TomcatLauncher {
 
-    private static final String idpHttpsPort = System.getProperty("idp.https.port");
-    private static final String rpHttpsPort = System.getProperty("rp.https.port");
+    private static final String IDP_HTTPS_PORT = System.getProperty("idp.https.port");
+    private static final String RP_HTTPS_PORT = System.getProperty("rp.https.port");
 
     private static Tomcat idpServer;
     private static Tomcat rpServer;
 
     public static void startServer(String servletContextName) throws Exception {
-        assertNotNull("Property 'idp.https.port' null", idpHttpsPort);
-        assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
+        assertNotNull("Property 'idp.https.port' null", IDP_HTTPS_PORT);
+        assertNotNull("Property 'rp.https.port' null", RP_HTTPS_PORT);
 
-        idpServer = startServer(idpHttpsPort, null);
-        rpServer = startServer(rpHttpsPort, servletContextName);
+        idpServer = startServer(IDP_HTTPS_PORT, null);
+        rpServer = startServer(RP_HTTPS_PORT, servletContextName);
     }
 
     private static Tomcat startServer(String port, String servletContextName)
@@ -96,7 +96,7 @@ public class TomcatLauncher {
             try (InputStream is = TomcatLauncher.class.getResourceAsStream("/fediz_config.xml")) {
                 byte[] content = new byte[is.available()];
                 is.read(content);
-                Files.write(fedizConfig, new String(content).replace("${idp.https.port}", idpHttpsPort).getBytes());
+                Files.write(fedizConfig, new String(content).replace("${idp.https.port}", IDP_HTTPS_PORT).getBytes());
             }
 
             FederationAuthenticator fa = new FederationAuthenticator();
@@ -125,11 +125,11 @@ public class TomcatLauncher {
     }
 
     public static String getIdpHttpsPort() {
-        return idpHttpsPort;
+        return IDP_HTTPS_PORT;
     }
 
     public static String getRpHttpsPort() {
-        return rpHttpsPort;
+        return RP_HTTPS_PORT;
     }
 
 }
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TomcatTest.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TomcatTest.java
index 26bd641..9dd64ed 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TomcatTest.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TomcatTest.java
@@ -20,14 +20,6 @@
 package org.apache.cxf.fediz.systests.tomcat;
 
 
-import org.apache.cxf.fediz.systests.common.AbstractTests;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
 import com.gargoylesoftware.htmlunit.CookieManager;
 import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
 import com.gargoylesoftware.htmlunit.WebClient;
@@ -37,6 +29,15 @@ import com.gargoylesoftware.htmlunit.html.HtmlForm;
 import com.gargoylesoftware.htmlunit.html.HtmlPage;
 import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
 
+import org.apache.cxf.fediz.systests.common.AbstractTests;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
 public class TomcatTest extends AbstractTests {
 
     private static final String SERVLET_CONTEXT_NAME = "fedizhelloworld";
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/WReqTest.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/WReqTest.java
index 3d26f45..f00ad4a 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/WReqTest.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/WReqTest.java
@@ -22,13 +22,6 @@ package org.apache.cxf.fediz.systests.tomcat;
 
 import java.io.IOException;
 
-import org.apache.cxf.fediz.core.ClaimTypes;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-
 import com.gargoylesoftware.htmlunit.WebClient;
 import com.gargoylesoftware.htmlunit.html.DomElement;
 import com.gargoylesoftware.htmlunit.html.DomNodeList;
@@ -36,6 +29,14 @@ import com.gargoylesoftware.htmlunit.html.HtmlForm;
 import com.gargoylesoftware.htmlunit.html.HtmlPage;
 import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
 
+import org.apache.cxf.fediz.core.ClaimTypes;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
 /**
  * A test for sending a TokenType request to the IdP via the "wreq" parameter.
  */
diff --git a/systests/webapps/cxfWebapp/src/main/java/org/apache/cxf/fediz/example/Service.java b/systests/webapps/cxfWebapp/src/main/java/org/apache/cxf/fediz/example/Service.java
index f2375c0..4e07bfb 100644
--- a/systests/webapps/cxfWebapp/src/main/java/org/apache/cxf/fediz/example/Service.java
+++ b/systests/webapps/cxfWebapp/src/main/java/org/apache/cxf/fediz/example/Service.java
@@ -19,8 +19,6 @@
 package org.apache.cxf.fediz.example;
 
 import java.security.Principal;
-import java.util.Arrays;
-import java.util.List;
 
 import javax.annotation.security.RolesAllowed;
 import javax.ws.rs.GET;
@@ -78,23 +76,19 @@ public class Service {
     @GET
     @Produces("text/html")
     public String doGetTest(@Context UriInfo uriInfo) throws Exception {
-        StringBuilder out = new StringBuilder();
-        out.append("<html>\n");
-        out.append("<head><title>WS Federation Systests Examples</title></head>\n");
-        out.append("<body>\n");
-        out.append("<P><H3>Secure Test</H3><P></P>");
-        out.append("</body>\n");
-
-        return out.toString();
+        return "<html>\n"
+            + "<head><title>WS Federation Systests Examples</title></head>\n"
+            + "<body>\n"
+            + "<P><H3>Secure Test</H3><P></P>"
+            + "</body>\n";
     }
 
     private String doGet(@Context UriInfo uriInfo) throws Exception {
-
-        StringBuilder out = new StringBuilder();
+        StringBuilder out = new StringBuilder(197);
         out.append("<html>\n");
         out.append("<head><title>WS Federation Systests Examples</title></head>\n");
         out.append("<body>\n");
-        out.append("<p>Request url: " + uriInfo.getAbsolutePath() + "</p>\n");
+        out.append("<p>Request url: ").append(uriInfo.getAbsolutePath()).append("</p>\n");
 
         out.append("<p>userPrincipal=");
         Principal p = messageContext.getSecurityContext().getUserPrincipal();
@@ -103,7 +97,7 @@ public class Service {
         }
         out.append("</p>\n");
 
-        List<String> roleListToCheck = Arrays.asList("Admin", "Manager", "User", "Authenticated");
+        String[] roleListToCheck = new String[]{"Admin", "Manager", "User", "Authenticated"};
         for (String item: roleListToCheck) {
             out.append("<p>role:" + item + "="
                 + ((messageContext.getSecurityContext().isUserInRole(item)) ? "true" : "false")