Repository: cxf Updated Branches: refs/heads/master 15ad9bd7e -> adba5b8c1
[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/adba5b8c Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/adba5b8c Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/adba5b8c Branch: refs/heads/master Commit: adba5b8c15edae00e90c56d94eee6118112266d0 Parents: 15ad9bd Author: Sergey Beryozkin <[email protected]> Authored: Tue Apr 1 17:26:52 2014 +0100 Committer: Sergey Beryozkin <[email protected]> Committed: Tue Apr 1 17:26:52 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/adba5b8c/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) {
