diff options
author | Udo Walter | 2020-05-09 01:41:41 +0200 |
---|---|---|
committer | Udo Walter | 2020-05-09 01:41:41 +0200 |
commit | 62b83a7a18e1878cf8192d80f02c10dffc0478d7 (patch) | |
tree | b3e071dbecea6bb0b71babb55c8cedbae07582a5 /src | |
parent | Add location selection (diff) | |
download | bwlp-guacamole-ext-62b83a7a18e1878cf8192d80f02c10dffc0478d7.tar.gz bwlp-guacamole-ext-62b83a7a18e1878cf8192d80f02c10dffc0478d7.tar.xz bwlp-guacamole-ext-62b83a7a18e1878cf8192d80f02c10dffc0478d7.zip |
Fix connecting to a new client after exiting a client. Add logo, favicon and logout button.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java | 4 | ||||
-rw-r--r-- | src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java | 30 | ||||
-rw-r--r-- | src/main/java/de/bwlehrpool/bwlp_guac/BwlpUserContext.java | 2 | ||||
-rw-r--r-- | src/main/resources/bwlpModule.js | 2 | ||||
-rw-r--r-- | src/main/resources/controllers/locationFieldController.js | 15 | ||||
-rw-r--r-- | src/main/resources/disclaimer.html | 1 | ||||
-rw-r--r-- | src/main/resources/guac-manifest.json | 3 | ||||
-rw-r--r-- | src/main/resources/images/Logo_bwLehrpool.svg | 66 | ||||
-rw-r--r-- | src/main/resources/images/Logo_bwLehrpool_symbol.png | bin | 0 -> 47241 bytes | |||
-rw-r--r-- | src/main/resources/styles/locationField.css | 5 | ||||
-rw-r--r-- | src/main/resources/styles/login.css | 11 | ||||
-rw-r--r-- | src/main/resources/templates/locationField.html | 1 | ||||
-rw-r--r-- | src/main/resources/translations/en.json | 3 |
13 files changed, 107 insertions, 36 deletions
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java b/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java index e9144f8..6126e77 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java @@ -143,7 +143,7 @@ public class AvailableClient implements Cloneable { if (now < this.lastConnectionCheck) { this.lastConnectionCheck = 0; } - if (now - this.lastConnectionCheck < 5000) + if (now - this.lastConnectionCheck < 1000) return this.connectionOk; for (;;) { try (VncConnection vnc = new VncConnection(this.clientip, 5900)) { @@ -172,7 +172,7 @@ public class AvailableClient implements Cloneable { return this.connectionOk = false; } } - + @Override public AvailableClient clone() { AvailableClient c = new AvailableClient(this.clientip); diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java index b902621..0fc7bc8 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java @@ -1,21 +1,15 @@ package de.bwlehrpool.bwlp_guac; -import java.io.IOException; import java.util.*; import org.apache.guacamole.GuacamoleException; -import org.apache.guacamole.form.TextField; import org.apache.guacamole.net.auth.*; import org.apache.guacamole.net.auth.credentials.GuacamoleCredentialsException; -import org.apache.guacamole.net.auth.credentials.GuacamoleInvalidCredentialsException; -import org.codehaus.jackson.JsonGenerationException; import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.http.HttpServletRequest; -import javax.xml.soap.Text; import org.apache.guacamole.form.Field; import org.apache.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException; @@ -34,11 +28,6 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider { } public AuthenticatedUser authenticateUser(Credentials credentials) throws GuacamoleException { - // XXX We can somehow request additional fields to be shown during login by throwing an exception - // that declares additional ones; but when I tried, it removed the existing username and password - // field, so do we need to state them too? Seems wrong since we don't need them, we'd just want - // an additional field to pick the room/location we want to end up in and let the actual - // authentication plugin define the username/password fields. return null; } @@ -60,21 +49,7 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider { public UserContext decorate(UserContext context, AuthenticatedUser authenticatedUser, Credentials credentials) throws GuacamoleException { - String username = authenticatedUser.getCredentials().getUsername(); - - LOGGER.warn("decorate called for " + username); - BwlpUserContext user = oldMappings.get(username); - - if (user != null) - return user; - - int locationid = requestLocation(credentials); - - LOGGER.warn("Doing the decoration"); - user = new BwlpUserContext(authenticatedUser, context, locationid); - oldMappings.put(username, user); - - return user; + return context; } private Map<String, BwlpUserContext> oldMappings = Collections @@ -130,8 +105,7 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider { correctPassword = ConnectionManager.getLocationPool().get(selectedId).password; } } catch (Exception e) { - LOGGER.info("Error reading location"); - LOGGER.info(e.toString()); + LOGGER.info("Error reading location", e); tryAgain = true; } diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpUserContext.java b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpUserContext.java index 05fa78f..ca020f6 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpUserContext.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpUserContext.java @@ -9,7 +9,6 @@ import org.apache.guacamole.net.auth.Directory; import org.apache.guacamole.net.auth.User; import org.apache.guacamole.net.auth.UserContext; import org.apache.guacamole.net.auth.credentials.GuacamoleCredentialsException; -import org.apache.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException; import org.apache.guacamole.net.auth.permission.ObjectPermissionSet; import org.apache.guacamole.net.auth.simple.SimpleConnection; import org.apache.guacamole.net.auth.simple.SimpleDirectory; @@ -105,6 +104,7 @@ public class BwlpUserContext extends AbstractUserContext { } catch (Exception e) { LOGGER.warn("hasValidConnection", e); } + if (!ok) connectionDirectory = new SimpleDirectory<Connection>(); return ok; } diff --git a/src/main/resources/bwlpModule.js b/src/main/resources/bwlpModule.js index c74580a..67fb487 100644 --- a/src/main/resources/bwlpModule.js +++ b/src/main/resources/bwlpModule.js @@ -2,4 +2,4 @@ angular.module('location', [ 'form' ]); -angular.module('index').requires.push('location');
\ No newline at end of file +angular.module('index').requires.push('location'); diff --git a/src/main/resources/controllers/locationFieldController.js b/src/main/resources/controllers/locationFieldController.js index 8117ed7..af2b6fe 100644 --- a/src/main/resources/controllers/locationFieldController.js +++ b/src/main/resources/controllers/locationFieldController.js @@ -1,9 +1,12 @@ -angular.module('location').controller('locationFieldController', ['$scope', '$window', - function locationFieldController($scope, $window) { +angular.module('location').controller('locationFieldController', ['$scope', function locationFieldController($scope) { - $scope.data = { id: 0, password: '' } + $scope.data = { id: 0, password: '' }; $scope.$watch('data', function(newValue) { + if (window.location.hash !== '#/') { + window.location.hash = '#/'; + window.location.reload(); + } $scope.model = JSON.stringify(newValue); }, true); @@ -20,4 +23,10 @@ angular.module('location').controller('locationFieldController', ['$scope', '$wi angular.element($event.currentTarget).addClass('selected-location'); }; + $scope.logout = function logout() { + window.localStorage.removeItem('GUAC_AUTH'); + window.location.hash = '#/'; + window.location.reload(); + } + }]);
\ No newline at end of file diff --git a/src/main/resources/disclaimer.html b/src/main/resources/disclaimer.html index be4cca3..b6c6190 100644 --- a/src/main/resources/disclaimer.html +++ b/src/main/resources/disclaimer.html @@ -3,4 +3,3 @@ <div class="welcome"> <h2>bwLehrpool</h2> </div> - diff --git a/src/main/resources/guac-manifest.json b/src/main/resources/guac-manifest.json index e507183..def8a3f 100644 --- a/src/main/resources/guac-manifest.json +++ b/src/main/resources/guac-manifest.json @@ -2,6 +2,8 @@ "guacamoleVersion" : "*", "name" : "bwLehrpool virtual pool", "namespace" : "de.bwlehrpool", + "smallIcon" : "images/Logo_bwLehrpool_symbol.png", + "largeIcon" : "images/Logo_bwLehrpool_symbol.png", "authProviders": ["de.bwlehrpool.bwlp_guac.BwlpAuthenticationProvider"], "html" : [ "disclaimer.html" ], "translations" : [ @@ -14,6 +16,7 @@ "bwlp.min.css" ], "resources" : { + "images/Logo_bwLehrpool.svg" : "image/svg+xml", "templates/locationField.html" : "text/html" } } diff --git a/src/main/resources/images/Logo_bwLehrpool.svg b/src/main/resources/images/Logo_bwLehrpool.svg new file mode 100644 index 0000000..8b6a230 --- /dev/null +++ b/src/main/resources/images/Logo_bwLehrpool.svg @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="564.83734" + height="131.315" + id="svg2985" + xml:space="preserve"><metadata + id="metadata2991"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs + id="defs2989"><clipPath + id="clipPath3001"><path + d="M 0,8356.66 0,0 l 4518.7,0 0,8356.66 -4518.7,0 z" + id="path3003" /></clipPath></defs><g + transform="matrix(1.25,0,0,-1.25,0,1044.5825)" + id="g2993"><g + id="g3598"><path + d="m 71.6785,784.102 -38.1996,0 0,15.545 30.4273,0 0,15.061 15.5458,0 0,-22.834 c 0,-4.294 -3.4786,-7.772 -7.7735,-7.772" + id="path3009" + style="fill:#f9a72b;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 92.0914,730.614 -14.8469,0 0,36.3 c 0.1778,4.161 3.6028,7.444 7.7688,7.444 l 83.6537,0 0,-15.546 -76.2041,0 -0.3715,-28.198" + id="path3011" + style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 66.1566,743.461 -15.6531,0 -0.1539,15.351 -50.3496,0 0,15.546 58.384,0 c 2.1047,0 4.1203,-0.854 5.5867,-2.369 1.4629,-1.513 2.25,-3.554 2.1816,-5.661 l 0.0043,-22.867" + id="path3013" + style="fill:#f9a72b;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 125.361,784.008 -28.8239,0 c -4.2922,0 -7.7742,3.481 -7.7742,7.775 l 0,43.473 15.5481,0 0,-35.7 21.05,0 0,-15.548" + id="path3015" + style="fill:#f9a72b;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 153.667,815.973 c -7.762,0 -10.206,-7.619 -10.206,-14.159 0,-6.756 1.94,-14.16 10.206,-14.16 7.691,0 10.207,7.404 10.207,14.16 0,6.756 -2.013,14.159 -10.207,14.159 z m -10.35,-32.2 -7.043,0 c 0.143,2.157 0.359,4.313 0.359,5.749 l 0,46.144 6.828,0 0,-20.699 0.144,0 c 2.084,4.312 6.612,5.965 11.213,5.965 11.212,0 16.244,-9.344 16.244,-19.118 0,-9.273 -4.313,-19.119 -15.022,-19.119 -5.248,0 -9.991,1.797 -12.435,6.827 l -0.144,0 0.144,-0.359 -0.288,-5.39" + id="path3017" + style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 233.448,819.854 -12.722,-36.081 -7.763,0 -8.409,29.684 -0.143,0 -9.344,-29.684 -7.979,0 -11.931,36.081 7.403,0 8.697,-29.038 0.144,0 8.985,29.038 8.84,0 8.122,-28.462 0.144,0 8.984,28.462 6.972,0" + id="path3019" + style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 239.055,783.773 0,51.893 4.6,0 0,-48.012 17.178,0 0,-3.881 -21.778,0" + id="path3021" + style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 286.346,804.473 c 0,8.05 -1.294,12.865 -8.193,12.865 -6.9,0 -8.195,-4.815 -8.195,-12.865 l 16.388,0 z m -16.388,-3.45 0,-2.803 c 0,-5.032 1.367,-11.715 8.195,-11.715 5.39,0 8.049,3.449 7.977,8.337 l 4.529,0 c -0.504,-8.769 -5.247,-11.788 -12.506,-11.788 -6.253,0 -12.507,2.516 -12.507,13.512 l 0,8.914 c 0,10.493 4.386,15.308 12.507,15.308 12.506,0 12.506,-8.984 12.506,-19.765 l -20.701,0" + id="path3023" + style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 298.493,783.773 0,51.893 4.312,0 0,-20.052 0.145,0 c 2.085,3.018 4.887,5.174 8.766,5.174 8.987,0 9.921,-6.683 9.921,-11.428 l 0,-25.587 -4.313,0 0,25.372 c 0,4.241 -1.654,8.193 -6.685,8.193 -3.882,0 -7.834,-2.658 -7.834,-10.78 l 0,-22.785 -4.312,0" + id="path3025" + style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 335.002,815.183 0.145,0 c 1.797,3.449 5.606,5.605 9.99,5.605 l 0,-4.383 c -6.109,0.502 -10.135,-3.163 -10.135,-9.273 l 0,-23.359 -4.312,0 0,36.297 4.312,0 0,-4.887" + id="path3027" + style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 354.842,798.723 c 0,-8.266 3.739,-12.218 7.691,-12.218 5.965,0 6.971,3.952 7.331,4.815 0.719,1.797 0.863,8.338 0.863,10.638 0,7.187 0,15.38 -7.689,15.38 -3.307,0 -8.196,-3.162 -8.196,-12.146 l 0,-6.469 z m -0.143,16.963 0.143,0.072 c 2.3,3.521 5.895,5.03 8.768,5.03 11.356,0 11.43,-9.918 11.43,-14.662 l 0,-8.122 c 0,-9.416 -3.236,-14.95 -12.507,-14.95 -2.66,0 -5.318,1.294 -7.547,4.744 l -0.144,0.073 0,-17.826 -4.312,0 0,50.025 4.169,0 0,-4.384" + id="path3029" + style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 401.2,791.32 c 0.718,1.797 0.863,8.338 0.863,10.638 0,10.708 -1.079,15.38 -8.195,15.38 -7.116,0 -8.195,-4.672 -8.195,-15.38 0,-2.3 0.145,-8.841 0.864,-10.638 0.359,-0.863 1.366,-4.815 7.331,-4.815 5.965,0 6.972,3.952 7.332,4.815 z m -19.839,6.684 0,8.625 c 0,4.6 0.071,14.159 12.507,14.159 12.435,0 12.507,-9.559 12.507,-14.159 l 0,-8.625 c 0,-9.416 -3.235,-14.95 -12.507,-14.95 -9.271,0 -12.507,5.534 -12.507,14.95" + id="path3031" + style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 433.113,791.32 c 0.718,1.797 0.862,8.338 0.862,10.638 0,10.708 -1.079,15.38 -8.194,15.38 -7.116,0 -8.195,-4.672 -8.195,-15.38 0,-2.3 0.145,-8.841 0.863,-10.638 0.359,-0.863 1.366,-4.815 7.332,-4.815 5.965,0 6.972,3.952 7.332,4.815 z m -19.839,6.684 0,8.625 c 0,4.6 0.071,14.159 12.507,14.159 12.434,0 12.506,-9.559 12.506,-14.159 l 0,-8.625 c 0,-9.416 -3.235,-14.95 -12.506,-14.95 -9.273,0 -12.507,5.534 -12.507,14.95" + id="path3033" + style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path + d="m 447.557,783.773 4.31289,0 0,51.893 -4.31289,0 0,-51.893 z" + id="path3035" + style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></svg>
\ No newline at end of file diff --git a/src/main/resources/images/Logo_bwLehrpool_symbol.png b/src/main/resources/images/Logo_bwLehrpool_symbol.png Binary files differnew file mode 100644 index 0000000..e26795f --- /dev/null +++ b/src/main/resources/images/Logo_bwLehrpool_symbol.png diff --git a/src/main/resources/styles/locationField.css b/src/main/resources/styles/locationField.css index cec1466..1764af9 100644 --- a/src/main/resources/styles/locationField.css +++ b/src/main/resources/styles/locationField.css @@ -44,4 +44,9 @@ margin: 0 !important; padding: 5px 8px !important; background-color: white !important; +} + +.logout-button { + float: left; + margin: 20px 0 0 0; }
\ No newline at end of file diff --git a/src/main/resources/styles/login.css b/src/main/resources/styles/login.css new file mode 100644 index 0000000..ab3b04d --- /dev/null +++ b/src/main/resources/styles/login.css @@ -0,0 +1,11 @@ +.login-ui .login-dialog .logo { + width: 215px; + height: 50px; + background-image: url('app/ext/de.bwlehrpool/images/Logo_bwLehrpool.svg'); + background-size: cover; + background-position: center; +} + +.login-ui .login-dialog .app-name { + display: none; +} diff --git a/src/main/resources/templates/locationField.html b/src/main/resources/templates/locationField.html index f76259e..9feb83c 100644 --- a/src/main/resources/templates/locationField.html +++ b/src/main/resources/templates/locationField.html @@ -16,3 +16,4 @@ </td> </tr> </table> +<button class="logout-button" ng-click="logout()">Log out</button> diff --git a/src/main/resources/translations/en.json b/src/main/resources/translations/en.json index 9ad430b..85a8b6e 100644 --- a/src/main/resources/translations/en.json +++ b/src/main/resources/translations/en.json @@ -1,4 +1,7 @@ { + "APP" : { + "NAME" : "bwLehrpool" + }, "LOGIN" : { "FIELD_HEADER_LOCATION" : "" } |