Repository: incubator-guacamole-client Updated Branches: refs/heads/master 68accbf45 -> 07fb473da
GUACAMOLE-204: Move ticket parameter code out of config and into run block. Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/d7218c3e Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/d7218c3e Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/d7218c3e Branch: refs/heads/master Commit: d7218c3e4434f0278cb08594e7c9b6a172131852 Parents: bf12d3c Author: Nick Couchman <[email protected]> Authored: Tue Mar 28 10:22:14 2017 -0400 Committer: Nick Couchman <[email protected]> Committed: Wed May 17 08:54:21 2017 -0400 ---------------------------------------------------------------------- .../src/main/resources/casConfig.js | 22 ---------- .../src/main/resources/casIndexTicket.js | 42 ++++++++++++++++++++ .../src/main/resources/guac-manifest.json | 3 +- 3 files changed, 44 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/d7218c3e/extensions/guacamole-auth-cas/src/main/resources/casConfig.js ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-cas/src/main/resources/casConfig.js b/extensions/guacamole-auth-cas/src/main/resources/casConfig.js index a90530d..76ee755 100644 --- a/extensions/guacamole-auth-cas/src/main/resources/casConfig.js +++ b/extensions/guacamole-auth-cas/src/main/resources/casConfig.js @@ -31,25 +31,3 @@ angular.module('guacCAS').config(['formServiceProvider', }); }]); - -/** - * Config block which augments the existing routing, providing special handling - * for the "ticket=" parameter provided by the CAS authentication process. - */ -angular.module('index').config(['$routeProvider','$windowProvider', - function indexRouteConfig($routeProvider,$windowProvider) { - - var $window = $windowProvider.$get(); - var curPath = $window.location.href; - var ticketPos = curPath.indexOf('?ticket='); - if (ticketPos < 0) - return null; - ticketPos += 8; - var hashPos = curPath.indexOf('#/'); - if (ticketPos < hashPos) { - var ticket = curPath.substring(ticketPos, hashPos); - var newPath = curPath.substring(0,ticketPos - 8) + '#/?ticket=' + ticket; - $window.location.href = newPath; - } - -}]); http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/d7218c3e/extensions/guacamole-auth-cas/src/main/resources/casIndexTicket.js ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-cas/src/main/resources/casIndexTicket.js b/extensions/guacamole-auth-cas/src/main/resources/casIndexTicket.js new file mode 100644 index 0000000..282ee65 --- /dev/null +++ b/extensions/guacamole-auth-cas/src/main/resources/casIndexTicket.js @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Index module run block that looks for the ticket parameter + * on the current location and moves it to the correct + * place to get processed by the Angular app. + */ +angular.module('index').run(['$injector', + function casIndexTicket($injector) { + + console.log('Running casIndexTicket...'); + var $window = $injector.get('$window'); + var curPath = $window.location.href; + var ticketPos = curPath.indexOf('?ticket='); + if (ticketPos < 0) + return null; + ticketPos += 8; + var hashPos = curPath.indexOf('#/'); + if (ticketPos < hashPos) { + var ticket = curPath.substring(ticketPos, hashPos); + var newPath = curPath.substring(0,ticketPos - 8) + '#/?ticket=' + ticket; + $window.location.href = newPath; + } + +}]); http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/d7218c3e/extensions/guacamole-auth-cas/src/main/resources/guac-manifest.json ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-cas/src/main/resources/guac-manifest.json b/extensions/guacamole-auth-cas/src/main/resources/guac-manifest.json index 2561a32..2c059b8 100644 --- a/extensions/guacamole-auth-cas/src/main/resources/guac-manifest.json +++ b/extensions/guacamole-auth-cas/src/main/resources/guac-manifest.json @@ -12,7 +12,8 @@ "js" : [ "casModule.js", "casController.js", - "casConfig.js" + "casConfig.js", + "casIndexTicket.js" ] }
