brooklyn-dev mailing list archives

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

    https://github.com/apache/brooklyn-server/pull/288#discussion_r73879297
  
    --- 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 --
    
    No need to go through an intermediate page here. Could execute the same Javascript in
https://github.com/apache/brooklyn-ui/pull/30/files#diff-d317a26aaa3190463c4c316d72ee9b6cR192
and remove the REST call.


---
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