brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorb...@apache.org
Subject [1/2] incubator-brooklyn git commit: Redirects web gui to root on logout to prevent login failure after logout
Date Thu, 05 Mar 2015 13:51:50 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 1b0037b60 -> dfdc68703


Redirects web gui to root on logout to prevent login failure after logout


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/9141302a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/9141302a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/9141302a

Branch: refs/heads/master
Commit: 9141302a6861f63bd7a9865224f81c31ef452dcf
Parents: eab2d39
Author: Martin Harris <github@nakomis.com>
Authored: Thu Mar 5 13:05:00 2015 +0000
Committer: Martin Harris <github@nakomis.com>
Committed: Thu Mar 5 13:05:00 2015 +0000

----------------------------------------------------------------------
 .../webapp/assets/js/util/brooklyn-utils.js     | 20 ++++++++++++++++++++
 usage/jsgui/src/main/webapp/index.html          |  2 +-
 .../BrooklynPropertiesSecurityFilter.java       |  1 +
 3 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9141302a/usage/jsgui/src/main/webapp/assets/js/util/brooklyn-utils.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/util/brooklyn-utils.js b/usage/jsgui/src/main/webapp/assets/js/util/brooklyn-utils.js
index 94a1299..318a734 100644
--- a/usage/jsgui/src/main/webapp/assets/js/util/brooklyn-utils.js
+++ b/usage/jsgui/src/main/webapp/assets/js/util/brooklyn-utils.js
@@ -174,6 +174,26 @@ define([
         return false; 
     };
 
+    Util.logout = function logout() {
+        $.ajax({
+            type: "POST",
+            dataType: "text",
+            url: "/logout",
+            success: function() {
+                window.location.replace("/");
+            },
+            failure: function() {
+                window.location.replace("/");
+            }
+        });
+    }
+
+    $("#logout-link").on("click", function (e) {
+        e.preventDefault();
+        Util.logout()
+        return false;
+    });
+
     return Util;
 
 });

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9141302a/usage/jsgui/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/index.html b/usage/jsgui/src/main/webapp/index.html
index 4458026..75733ab 100644
--- a/usage/jsgui/src/main/webapp/index.html
+++ b/usage/jsgui/src/main/webapp/index.html
@@ -44,7 +44,7 @@ under the License.
 
 <div class="navbar navbar-fixed-top">
     <div class="navbar-inner">
-        <div class="userName-top"><span id="user"></span> | <a href="/logout">Log
out</a></div>
+        <div class="userName-top"><span id="user"></span> | <a href="/logout"
id="logout-link">Log out</a></div>
         <div class="container">
             <a class="logo" href="#" title="Brooklyn, Version 0.7.0-SNAPSHOT"><!--
Logo added via CSS --></a> <!-- BROOKLYN_VERSION -->
             <div class="menubar-top">

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9141302a/usage/rest-server/src/main/java/brooklyn/rest/filter/BrooklynPropertiesSecurityFilter.java
----------------------------------------------------------------------
diff --git a/usage/rest-server/src/main/java/brooklyn/rest/filter/BrooklynPropertiesSecurityFilter.java
b/usage/rest-server/src/main/java/brooklyn/rest/filter/BrooklynPropertiesSecurityFilter.java
index e947194..7202a6a 100644
--- a/usage/rest-server/src/main/java/brooklyn/rest/filter/BrooklynPropertiesSecurityFilter.java
+++ b/usage/rest-server/src/main/java/brooklyn/rest/filter/BrooklynPropertiesSecurityFilter.java
@@ -95,6 +95,7 @@ public class BrooklynPropertiesSecurityFilter implements Filter {
                 httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED);
             } else {
                 RequestDispatcher dispatcher = httpRequest.getRequestDispatcher("/");
+                log.debug("Not authenticated, forwarding request for {} to {}", uri, dispatcher);
                 dispatcher.forward(httpRequest, httpResponse);
             }
             return;


Mime
View raw message