brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bostko <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #288: BROOKLYN-323: Simplify Logout api
Date Fri, 12 Aug 2016 10:30:53 GMT
Github user bostko commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/288#discussion_r74571173
  
    --- Diff: rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/LogoutResource.java
---
    @@ -37,32 +37,45 @@
         @Context UriInfo uri;
     
         @Override
    +    public Response redirectToLogout() {
    +        URI dest = uri.getBaseUriBuilder().path(LogoutApi.class).build();
    +
    +        // Return response with Javascript which will make an asynchronous POST request
to the logout method.
    +        // (When calling logout it is important to use wrong username and password in
order to make browser forget the old ones)
    +        return Response.status(Status.OK)
    +                .entity(String.format("<!DOCTYPE html>\n<body>\n" +
    +                        "<script>\n" +
    +                        "var a=new window.XMLHttpRequest;" +
    +                        "a.open('POST','%1$s',0,'user','wrong'+(new Date).getTime().toString());a.send(\"\");\n"
+
    +                        "window.location.href='/';</script></body>", dest.toASCIIString()))
    +                .build();
    --- End diff --
    
    This is needed to reload the whole DOM.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message