From e5a3a1d737e88c89a4ba3fbc8d277745093139b1 Mon Sep 17 00:00:00 2001 From: Udo Walter Date: Wed, 13 May 2020 14:04:52 +0200 Subject: Add some debug logs. Rename the 'virtual' locations to groups. --- .../bwlp_guac/BwlpAuthenticationProvider.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java') diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java index 0fc7bc8..c59c477 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java @@ -66,26 +66,26 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider { if (user != null && user.hasValidConnection()) return user; - int locationid = requestLocation(credentials); + int groupid = requestGroup(credentials); LOGGER.warn("Doing the REdecoration"); - user = new BwlpUserContext(authenticatedUser, context, locationid); + user = new BwlpUserContext(authenticatedUser, context, groupid); oldMappings.put(username, user); return user; } - private int requestLocation(Credentials credentials) throws GuacamoleException { - // Request the user to select a location + private int requestGroup(Credentials credentials) throws GuacamoleException { + // Request the user to select a group ConnectionManager.updateList(); HttpServletRequest request = credentials.getRequest(); - String locationJson = request.getParameter("location"); + String groupJson = request.getParameter("group"); - if (locationJson == null) { + if (groupJson == null) { throw new GuacamoleInsufficientCredentialsException( "Select Location", new CredentialsInfo( - Collections.singletonList(new LocationField()) + Collections.singletonList(new GroupField()) )); } @@ -98,14 +98,14 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider { String password = ""; String correctPassword = null; try { - JsonNode location = mapper.readTree(locationJson); - selectedId = Integer.parseInt(location.get("id").asText()); + JsonNode group = mapper.readTree(groupJson); + selectedId = Integer.parseInt(group.get("id").asText()); if (selectedId != 0) { - password = location.get("password").asText(); - correctPassword = ConnectionManager.getLocationPool().get(selectedId).password; + password = group.get("password").asText(); + correctPassword = ConnectionManager.getGroupPool().get(selectedId).password; } } catch (Exception e) { - LOGGER.info("Error reading location", e); + LOGGER.info("Error reading group", e); tryAgain = true; } @@ -117,7 +117,7 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider { if (tryAgain) { throw new GuacamoleCredentialsException( message, new CredentialsInfo( - Collections.singletonList(new LocationField()) + Collections.singletonList(new GroupField()) )); } -- cgit v1.2.3-55-g7522