cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject git commit: Updating non-Tomcat plugins to remove hard-coded references to the FederationProcessorImpl
Date Thu, 10 Jul 2014 14:26:42 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/master e24966d39 -> 940c54a65


Updating non-Tomcat plugins to remove hard-coded references to the FederationProcessorImpl


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/940c54a6
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/940c54a6
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/940c54a6

Branch: refs/heads/master
Commit: 940c54a65b7ca87ce9b6d5f6dec6de755fca40f9
Parents: e24966d
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Jul 10 15:26:14 2014 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Jul 10 15:26:14 2014 +0100

----------------------------------------------------------------------
 .../cxf/fediz/jetty/FederationAuthenticator.java   | 17 ++++++++++++-----
 .../cxf/fediz/jetty/FederationLoginService.java    |  5 +++--
 .../FederationAuthenticationProvider.java          | 10 +++++++---
 .../web/FederationAuthenticationEntryPoint.java    |  5 +++--
 .../spring/web/FederationLogoutSuccessHandler.java |  7 ++++---
 .../FederationAuthenticationProvider.java          |  9 ++++++---
 .../web/FederationAuthenticationEntryPoint.java    |  8 +++++---
 7 files changed, 40 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/940c54a6/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java
----------------------------------------------------------------------
diff --git a/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java
b/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java
index 8cb9923..223c954 100644
--- a/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java
+++ b/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java
@@ -38,8 +38,8 @@ 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.exception.ProcessingException;
-import org.apache.cxf.fediz.core.processor.FederationProcessorImpl;
 import org.apache.cxf.fediz.core.processor.FedizProcessor;
+import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
 import org.apache.cxf.fediz.core.processor.FedizRequest;
 import org.apache.cxf.fediz.core.processor.FedizResponse;
 import org.apache.cxf.fediz.core.processor.RedirectionResponse;
@@ -56,7 +56,6 @@ import org.eclipse.jetty.server.Authentication.User;
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.UserIdentity;
 import org.eclipse.jetty.util.MultiMap;
-import org.eclipse.jetty.util.StringUtil;
 import org.eclipse.jetty.util.URIUtil;
 import org.eclipse.jetty.util.log.Log;
 import org.eclipse.jetty.util.log.Logger;
@@ -235,7 +234,7 @@ public class FederationAuthenticator extends LoginAuthenticator {
 
                         // not authenticated
                         if (LOG.isDebugEnabled()) {
-                            LOG.debug("WSFED authentication FAILED for " + StringUtil.printable(user.getUserPrincipal().getName()));
+                            LOG.debug("WSFED authentication FAILED");
                         }
                         if (response != null) {
                             response.sendError(HttpServletResponse.SC_FORBIDDEN);
@@ -295,7 +294,8 @@ public class FederationAuthenticator extends LoginAuthenticator {
                     if (logoutUrl != null && !logoutUrl.isEmpty() && uri.equals(contextName
+ logoutUrl)) {
                         session.invalidate();
 
-                        FedizProcessor wfProc = new FederationProcessorImpl();
+                        FedizProcessor wfProc = 
+                            FedizProcessorFactory.newFedizProcessor(fedConfig.getProtocol());
                         signOutRedirectToIssuer(request, response, wfProc);
 
                         return Authentication.SEND_CONTINUE;
@@ -361,7 +361,14 @@ public class FederationAuthenticator extends LoginAuthenticator {
                 }
             }
             
-            FedizProcessor wfProc = new FederationProcessorImpl();
+            String contextName = request.getSession().getServletContext().getContextPath();
+            if (contextName == null || contextName.isEmpty()) {
+                contextName = "/";
+            }
+            FedizContext fedConfig = getContextConfiguration(contextName);
+            
+            FedizProcessor wfProc = 
+                FedizProcessorFactory.newFedizProcessor(fedConfig.getProtocol());
             signInRedirectToIssuer(request, response, wfProc);
 
             return Authentication.SEND_CONTINUE;

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/940c54a6/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationLoginService.java
----------------------------------------------------------------------
diff --git a/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationLoginService.java
b/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationLoginService.java
index c1ca4b4..7c7e03a 100644
--- a/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationLoginService.java
+++ b/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationLoginService.java
@@ -27,8 +27,8 @@ import javax.security.auth.Subject;
 
 import org.apache.cxf.fediz.core.config.FedizContext;
 import org.apache.cxf.fediz.core.exception.ProcessingException;
-import org.apache.cxf.fediz.core.processor.FederationProcessorImpl;
 import org.apache.cxf.fediz.core.processor.FedizProcessor;
+import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
 import org.apache.cxf.fediz.core.processor.FedizRequest;
 import org.apache.cxf.fediz.core.processor.FedizResponse;
 import org.eclipse.jetty.security.IdentityService;
@@ -85,7 +85,8 @@ public class FederationLoginService extends AbstractLifeCycle implements
LoginSe
                 LOG.debug("wresult=\n" + wfReq.getWresult());
             }
             
-            FedizProcessor wfProc = new FederationProcessorImpl();
+            FedizProcessor wfProc = 
+                FedizProcessorFactory.newFedizProcessor(config.getProtocol());
             try {
                 wfRes = wfProc.processRequest(wfReq, config);
             } catch (ProcessingException ex) {

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/940c54a6/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java
----------------------------------------------------------------------
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 a5a1390..b103565 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
@@ -19,8 +19,9 @@
 
 package org.apache.cxf.fediz.spring.authentication;
 
-import org.apache.cxf.fediz.core.processor.FederationProcessorImpl;
+import org.apache.cxf.fediz.core.config.FedizContext;
 import org.apache.cxf.fediz.core.processor.FedizProcessor;
+import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
 import org.apache.cxf.fediz.core.processor.FedizRequest;
 import org.apache.cxf.fediz.core.processor.FedizResponse;
 import org.apache.cxf.fediz.spring.FederationConfig;
@@ -115,8 +116,11 @@ public class FederationAuthenticationProvider implements AuthenticationProvider,
         throws AuthenticationException {
         try {
             FedizRequest wfReq = (FedizRequest)authentication.getCredentials();
-            FedizProcessor wfProc = new FederationProcessorImpl();
-            FedizResponse wfRes = wfProc.processRequest(wfReq, federationConfig.getFedizContext());
+            
+            FedizContext fedContext = federationConfig.getFedizContext();
+            FedizProcessor wfProc = 
+                FedizProcessorFactory.newFedizProcessor(fedContext.getProtocol());
+            FedizResponse wfRes = wfProc.processRequest(wfReq, fedContext);
 
             final UserDetails userDetails = loadUserByFederationResponse(wfRes);
             userDetailsChecker.check(userDetails);

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/940c54a6/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java
----------------------------------------------------------------------
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 d30fb58..8033930 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
@@ -28,8 +28,8 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.cxf.fediz.core.config.FedizContext;
 import org.apache.cxf.fediz.core.exception.ProcessingException;
-import org.apache.cxf.fediz.core.processor.FederationProcessorImpl;
 import org.apache.cxf.fediz.core.processor.FedizProcessor;
+import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
 import org.apache.cxf.fediz.core.processor.RedirectionResponse;
 import org.apache.cxf.fediz.spring.FederationConfig;
 import org.slf4j.Logger;
@@ -78,7 +78,8 @@ public class FederationAuthenticationEntryPoint implements AuthenticationEntryPo
         FedizContext fedContext = federationConfig.getFedizContext();
         LOG.debug("Federation context: {}", fedContext);
         try {
-            FedizProcessor wfProc = new FederationProcessorImpl();
+            FedizProcessor wfProc = 
+                FedizProcessorFactory.newFedizProcessor(fedContext.getProtocol());
             RedirectionResponse redirectionResponse =
                 wfProc.createSignInRequest(servletRequest, fedContext);
             redirectUrl = redirectionResponse.getRedirectionURL();

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/940c54a6/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationLogoutSuccessHandler.java
----------------------------------------------------------------------
diff --git a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationLogoutSuccessHandler.java
b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationLogoutSuccessHandler.java
index 466d989..1a2dba3 100644
--- a/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationLogoutSuccessHandler.java
+++ b/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/web/FederationLogoutSuccessHandler.java
@@ -27,8 +27,8 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.cxf.fediz.core.config.FedizContext;
 import org.apache.cxf.fediz.core.exception.ProcessingException;
-import org.apache.cxf.fediz.core.processor.FederationProcessorImpl;
 import org.apache.cxf.fediz.core.processor.FedizProcessor;
+import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
 import org.apache.cxf.fediz.core.processor.RedirectionResponse;
 import org.apache.cxf.fediz.spring.FederationConfig;
 import org.slf4j.Logger;
@@ -51,15 +51,16 @@ public class FederationLogoutSuccessHandler implements LogoutSuccessHandler
{
     @Override
     public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response,
                                 Authentication authentication) throws IOException, ServletException
{
-        FedizProcessor processor = new FederationProcessorImpl();
         String contextName = request.getContextPath();
         if (contextName == null || contextName.isEmpty()) {
             contextName = "/";
         }
         FedizContext fedCtx = federationConfig.getFedizContext(contextName);
         try {
+            FedizProcessor wfProc = 
+                FedizProcessorFactory.newFedizProcessor(fedCtx.getProtocol());
             RedirectionResponse redirectionResponse =
-                processor.createSignOutRequest(request, fedCtx);
+                wfProc.createSignOutRequest(request, fedCtx);
             String redirectURL = redirectionResponse.getRedirectionURL();
             if (redirectURL != null) {
                 Map<String, String> headers = redirectionResponse.getHeaders();

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/940c54a6/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java
b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java
index d58e210..9796608 100644
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java
+++ b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java
@@ -19,8 +19,9 @@
 
 package org.apache.cxf.fediz.spring.authentication;
 
-import org.apache.cxf.fediz.core.processor.FederationProcessorImpl;
+import org.apache.cxf.fediz.core.config.FedizContext;
 import org.apache.cxf.fediz.core.processor.FedizProcessor;
+import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
 import org.apache.cxf.fediz.core.processor.FedizRequest;
 import org.apache.cxf.fediz.core.processor.FedizResponse;
 import org.apache.cxf.fediz.spring.FederationConfig;
@@ -114,8 +115,10 @@ public class FederationAuthenticationProvider implements AuthenticationProvider,
         throws AuthenticationException {
         try {
             FedizRequest wfReq = (FedizRequest)authentication.getCredentials();
-            FedizProcessor wfProc = new FederationProcessorImpl();
-            FedizResponse wfRes = wfProc.processRequest(wfReq, federationConfig.getFedizContext());
+            FedizContext context = federationConfig.getFedizContext();
+            FedizProcessor wfProc = 
+                FedizProcessorFactory.newFedizProcessor(context.getProtocol());
+            FedizResponse wfRes = wfProc.processRequest(wfReq, context);
 
             final UserDetails userDetails = loadUserByFederationResponse(wfRes);
             userDetailsChecker.check(userDetails);

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/940c54a6/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java
b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java
index 9bb3482..a2e762f 100644
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java
+++ b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java
@@ -30,8 +30,8 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.cxf.fediz.core.config.FedizContext;
 import org.apache.cxf.fediz.core.exception.ProcessingException;
-import org.apache.cxf.fediz.core.processor.FederationProcessorImpl;
 import org.apache.cxf.fediz.core.processor.FedizProcessor;
+import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
 import org.apache.cxf.fediz.core.processor.RedirectionResponse;
 import org.apache.cxf.fediz.spring.FederationConfig;
 import org.slf4j.Logger;
@@ -81,7 +81,8 @@ public class FederationAuthenticationEntryPoint implements AuthenticationEntryPo
         FedizContext fedContext = federationConfig.getFedizContext();
         LOG.debug("Federation context: {}", fedContext);
         try {
-            FedizProcessor wfProc = new FederationProcessorImpl();
+            FedizProcessor wfProc = 
+                FedizProcessorFactory.newFedizProcessor(fedContext.getProtocol());
             RedirectionResponse redirectionResponse =
                 wfProc.createSignInRequest(servletRequest, fedContext);
             redirectUrl = redirectionResponse.getRedirectionURL();
@@ -136,7 +137,8 @@ public class FederationAuthenticationEntryPoint implements AuthenticationEntryPo
         FedizContext fedContext = federationConfig.getFedizContext();
         LOG.debug("Federation context: {}", fedContext);
         try {
-            FedizProcessor wfProc = new FederationProcessorImpl();
+            FedizProcessor wfProc = 
+                FedizProcessorFactory.newFedizProcessor(fedContext.getProtocol());
             
             RedirectionResponse redirectionResponse =
                 wfProc.createSignInRequest(hrequest, fedContext);


Mime
View raw message