summaryrefslogtreecommitdiffstats
path: root/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java')
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java
index 017c806..a75d585 100644
--- a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java
+++ b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java
@@ -70,17 +70,23 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider {
if (exConn != null) {
user = new BwlpUserContext(authenticatedUser, context, exConn);
} else {
- int groupid = requestGroup(credentials);
+ UserResponse response = requestGroup(credentials);
LOGGER.warn("Doing the REdecoration");
- user = new BwlpUserContext(authenticatedUser, context, groupid);
+ user = new BwlpUserContext(authenticatedUser, context, response.groupid, response.resolution);
}
oldMappings.put(username, user);
return user;
}
+ final class UserResponse {
+ public int groupid = 0;
+ public String resolution = "1920x1080";
+ }
+
+ private UserResponse requestGroup(Credentials credentials) throws GuacamoleException {
+ UserResponse response = new UserResponse();
- private int requestGroup(Credentials credentials) throws GuacamoleException {
// Request the user to select a group
ConnectionManager.updateList();
HttpServletRequest request = credentials.getRequest();
@@ -97,23 +103,24 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider {
String message = "Select a Location";
- int selectedId = 0;
boolean tryAgain = false;
String password = "";
String correctPassword = null;
try {
JsonNode group = mapper.readTree(groupJson);
- selectedId = Integer.parseInt(group.get("id").asText());
- if (selectedId != 0) {
+ response.resolution = group.get("resolution").asText();
+
+ response.groupid = Integer.parseInt(group.get("id").asText());
+ if (response.groupid != 0) {
password = group.get("password").asText();
- correctPassword = ConnectionManager.getGroupPool().get(selectedId).password;
+ correctPassword = ConnectionManager.getGroupPool().get(response.groupid).password;
}
} catch (Exception e) {
LOGGER.info("Error reading group", e);
tryAgain = true;
}
- if (selectedId != 0 && correctPassword != null && !password.equals(correctPassword)) {
+ if (response.groupid != 0 && correctPassword != null && !password.equals(correctPassword)) {
tryAgain = true;
message = "Wrong password!";
}
@@ -125,7 +132,7 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider {
));
}
- return selectedId;
+ return response;
}
public void shutdown() {