cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5633] Minor udates to logout service
Date Tue, 01 Apr 2014 16:29:17 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 26d0beb06 -> a946e7080


[CXF-5633] Minor udates to logout service


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

Branch: refs/heads/2.7.x-fixes
Commit: a946e7080722020c49d41bc43821d6bba36f64e7
Parents: 26d0beb
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Apr 1 17:26:52 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Apr 1 17:29:01 2014 +0100

----------------------------------------------------------------------
 .../cxf/rs/security/saml/sso/LogoutService.java | 24 ++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a946e708/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/LogoutService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/LogoutService.java
b/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/LogoutService.java
index 1dad97a..048f7c1 100644
--- a/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/LogoutService.java
+++ b/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/LogoutService.java
@@ -23,7 +23,9 @@ import java.util.logging.Logger;
 
 import javax.ws.rs.CookieParam;
 import javax.ws.rs.GET;
+import javax.ws.rs.POST;
 import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Cookie;
 
@@ -42,17 +44,31 @@ public class LogoutService {
     private String mainApplicationAddress;
     
     @GET
+    @Produces("text/html")
     public LogoutResponse logout(@CookieParam(SSOConstants.SECURITY_CONTEXT_TOKEN) Cookie
context,
                        @Context SecurityContext sc) {
+        doLogout(context, sc);
+        // Use View Handler to tell the user that the logout has been successful,
+        // optionally listing the user login name and/or linking to the main application
address, 
+        // the user may click on it, will be redirected to IDP and the process will start
again
+        return new LogoutResponse(sc.getUserPrincipal().getName(), mainApplicationAddress);
+    }
+    
+    @POST
+    @Produces("text/html")
+    public LogoutResponse postLogout(@CookieParam(SSOConstants.SECURITY_CONTEXT_TOKEN) Cookie
context,
+                                     @Context SecurityContext sc) {
+        return logout(context, sc);
+    }
+    
+    
+    
+    private void doLogout(Cookie context, SecurityContext sc) {
         if (context == null || sc.getUserPrincipal() == null || sc.getUserPrincipal().getName()
== null) {
             reportError("MISSING_RESPONSE_STATE");
             throw ExceptionUtils.toBadRequestException(null, null);
         }
         stateProvider.removeResponseState(context.getValue());
-        // Use View Handler to tell the user that the logout has been successful,
-        // optionally linking to the main application address - the user may click on it
-        // and will be redirected to IDP and the process will start again
-        return new LogoutResponse(sc.getUserPrincipal().getName(), mainApplicationAddress);
     }
     
     protected void reportError(String code) {


Mime
View raw message