Skip to content

Commit

Permalink
KEYCLOAK-667 Remove client-side idle timeout from admin console - wit…
Browse files Browse the repository at this point in the history
…h sso idle timeout we have a server-side mechanism for this
  • Loading branch information
stianst committed Sep 9, 2014
1 parent 3530fa6 commit a1b6378
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 17,6 @@
<script src="lib/angular/angular-route.js"></script>
<script src="lib/angular/ui-bootstrap-tpls-0.11.0.js"></script>

<script src="lib/jquery/jquery.idletimer.js" type="text/javascript"></script>
<script src="lib/jquery/jquery.idletimeout.js" type="text/javascript"></script>
<script src="lib/angular/select2.js" type="text/javascript"></script>
<script src="lib/fileupload/angular-file-upload.min.js"></script>
<script src="lib/filesaver/FileSaver.js"></script>
Expand Down Expand Up @@ -75,28 73,5 @@
</div>
</div>

<script type="text/javascript">
$.idleTimeout('#idletimeout', '#idletimeout a', {
idleAfter: 300,
pollingInterval: 60,
// keepAliveURL: authUrl '/admin/keepalive', would need to change this path
serverResponseEquals: '',
failedRequests: 1,
onTimeout: function(){
$(this).slideUp();
logout();
},
onIdle: function(){
$(this).slideDown(); // show the warning bar
},
onCountdown: function( counter ){
$(this).find("span").html( counter ); // update the counter
},
onResume: function(){
$(this).slideUp(); // hide the warning bar
}
});
</script>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 4,9 @@ var consoleBaseUrl = window.location.href;
consoleBaseUrl = consoleBaseUrl.substring(0, consoleBaseUrl.indexOf("/console"));
consoleBaseUrl = consoleBaseUrl "/console";
var configUrl = consoleBaseUrl "/config";
var logoutUrl = consoleBaseUrl "/logout";
var auth = {};
var logout = function(){
console.log('*** LOGOUT');
window.location = logoutUrl;
};


var authUrl = window.location.href;
authUrl = authUrl.substring(0, authUrl.indexOf('/admin/'));

var auth = {};
var authUrl = window.location.href.substring(0, window.location.href.indexOf('/admin/'));

var module = angular.module('keycloak', [ 'keycloak.services', 'keycloak.loaders', 'ui.bootstrap', 'ui.select2', 'angularFileUpload' ]);
var resourceRequests = 0;
Expand Down Expand Up @@ -803,14 795,13 @@ module.config(function($httpProvider) {

});

module.factory('errorInterceptor', function($q, $window, $rootScope, $location,Notifications) {
module.factory('errorInterceptor', function($q, $window, $rootScope, $location, Notifications, Auth) {
return function(promise) {
return promise.then(function(response) {
return response;
}, function(response) {
if (response.status == 401) {
console.log('session timeout?');
logout();
Auth.authz.logout();
} else if (response.status == 403) {
Notifications.error("Forbidden");
} else if (response.status == 404) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 4,6 @@ module.controller('GlobalCtrl', function($scope, $http, Auth, WhoAmI, Current, $
};

$scope.authUrl = authUrl;
$scope.logout = logout;

$scope.auth = Auth;

WhoAmI.get(function (data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 20,7 @@ <h1 class="navbar-title">Keycloak</h1>
</a>
<ul class="dropdown-menu">
<li><a href="{{authUrl}}/realms/{{auth.user.realm}}/account?referrer=security-admin-console">Manage Account</a></li>
<li class="separator"><a href="" ng-click="logout()">Sign Out</a></li>
<li class="separator"><a href="" ng-click="auth.authz.logout()">Sign Out</a></li>
</ul>
</li>
</ul>
Expand Down

0 comments on commit a1b6378

Please sign in to comment.