cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/2] cxf-fediz git commit: NPE fix
Date Mon, 20 Feb 2017 17:31:12 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/master 0dabf1562 -> 5667ed43a


NPE fix


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

Branch: refs/heads/master
Commit: d48929d903db8ddf71137aeb2b551c8e686b52ef
Parents: 0dabf15
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Feb 20 17:11:12 2017 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Feb 20 17:11:12 2017 +0000

----------------------------------------------------------------------
 .../logout/LogoutRedirectConstraintHandler.java | 23 +++++++++++++-------
 1 file changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/d48929d9/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/logout/LogoutRedirectConstraintHandler.java
----------------------------------------------------------------------
diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/logout/LogoutRedirectConstraintHandler.java
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/logout/LogoutRedirectConstraintHandler.java
index b1100d7..8335a5c 100644
--- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/logout/LogoutRedirectConstraintHandler.java
+++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/logout/LogoutRedirectConstraintHandler.java
@@ -48,19 +48,26 @@ public class LogoutRedirectConstraintHandler implements CallbackHandler
{
                     if (request != null && request.getParameter(OAuthConstants.CLIENT_ID)
!= null) {
                         String clientId = request.getParameter(OAuthConstants.CLIENT_ID);
 
-                        ApplicationContext ctx = ApplicationContextProvider.getApplicationContext();
-                        OAuthDataProvider dataManager = (OAuthDataProvider)ctx.getBean("oauthProvider");
-
-                        Client client = dataManager.getClient(clientId);
-                        String logoutUri = client.getProperties().get(CLIENT_LOGOUT_URI);
-                        if (logoutUri != null) {
-                            replyConstraintCallback.setReplyConstraint(Pattern.compile(logoutUri));
-                        }
+                        replyConstraintCallback.setReplyConstraint(getLogoutRedirectConstraint(clientId));
                     }
                 }
             }
         }
     }
 
+    private Pattern getLogoutRedirectConstraint(String clientId) {
+        ApplicationContext ctx = ApplicationContextProvider.getApplicationContext();
+        OAuthDataProvider dataManager = (OAuthDataProvider)ctx.getBean("oauthProvider");
+
+        Client client = dataManager.getClient(clientId);
+        if (client != null) {
+            String logoutUri = client.getProperties().get(CLIENT_LOGOUT_URI);
+            if (logoutUri != null) {
+                return Pattern.compile(logoutUri);
+            }
+        }
+        
+        return null;
+    }
 
 }


Mime
View raw message