summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java44
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/ConnectionManager.java13
-rw-r--r--src/main/resources/continue-patch.html5
-rw-r--r--src/main/resources/guac-manifest.json7
-rw-r--r--src/main/resources/translations/de.json3
-rw-r--r--src/main/resources/translations/en.json3
6 files changed, 58 insertions, 17 deletions
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java
index f73de84..3043339 100644
--- a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java
+++ b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java
@@ -1,23 +1,45 @@
package de.bwlehrpool.bwlp_guac;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.*;
-
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.net.auth.*;
-import org.apache.guacamole.net.auth.credentials.GuacamoleCredentialsException;
+import org.apache.guacamole.language.TranslatableGuacamoleCredentialsException;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
-
import org.apache.guacamole.form.Field;
-import org.apache.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException;
+import org.apache.guacamole.language.TranslatableGuacamoleInsufficientCredentialsException;
import org.apache.guacamole.net.auth.credentials.CredentialsInfo;
public class BwlpAuthenticationProvider implements AuthenticationProvider {
- Logger LOGGER = LoggerFactory.getLogger(BwlpAuthenticationProvider.class);
+ static Logger LOGGER = LoggerFactory.getLogger(BwlpAuthenticationProvider.class);
+
+ static Properties MANIFEST = new Properties();
+
+ static {
+ URLClassLoader cl = (URLClassLoader) BwlpAuthenticationProvider.class.getClassLoader();
+ URL url = cl.findResource("META-INF/MANIFEST.MF");
+ try {
+ MANIFEST.load(url.openStream());
+ LOGGER.info("Plugin build revision: " + MANIFEST.getProperty("Build-Revision"));
+
+ String timestamp = MANIFEST.getProperty("Build-Revision-Timestamp");
+ DateFormat formatter = new SimpleDateFormat("yyyy.MM.dd HH:mm");
+ long milliSeconds= Long.parseLong(timestamp);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(milliSeconds);
+ LOGGER.info("Plugin build timestamp: " + formatter.format(calendar.getTime()));
+ } catch (Exception e) {
+ System.out.println("unable to read manifest " + e.getMessage());
+ }
+ }
public String getIdentifier() {
return "de.bwlehrpool.bwgpul";
@@ -58,6 +80,8 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider {
public UserContext redecorate(UserContext decorated, UserContext context, AuthenticatedUser authenticatedUser,
Credentials credentials) throws GuacamoleException {
+ LOGGER.info(MANIFEST.getProperty("Build-Revision"));
+
String username = Util.getUsername(authenticatedUser);
if (username == null) {
LOGGER.warn("redecorate: Ignoring user without name");
@@ -97,8 +121,9 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider {
String groupJson = request.getParameter("group");
if (groupJson == null) {
- throw new GuacamoleInsufficientCredentialsException(
- "GROUP_SELECTION.TITLE", new CredentialsInfo(
+ LOGGER.warn("test 1");
+ throw new TranslatableGuacamoleInsufficientCredentialsException(
+ "GROUP_SELECTION.TITLE", "GROUP_SELECTION.TITLE", new CredentialsInfo(
Collections.<Field>singletonList(new GroupField())
));
}
@@ -130,8 +155,9 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider {
}
if (tryAgain) {
- throw new GuacamoleCredentialsException(
- message, new CredentialsInfo(
+ LOGGER.warn("test 2");
+ throw new TranslatableGuacamoleCredentialsException(
+ message, message, new CredentialsInfo(
Collections.<Field>singletonList(new GroupField())
));
}
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/ConnectionManager.java b/src/main/java/de/bwlehrpool/bwlp_guac/ConnectionManager.java
index db8ff07..1f7d928 100644
--- a/src/main/java/de/bwlehrpool/bwlp_guac/ConnectionManager.java
+++ b/src/main/java/de/bwlehrpool/bwlp_guac/ConnectionManager.java
@@ -30,7 +30,8 @@ import javax.net.ssl.X509TrustManager;
import org.apache.guacamole.form.Field;
import org.apache.guacamole.net.auth.credentials.CredentialsInfo;
import org.apache.guacamole.net.auth.credentials.GuacamoleCredentialsException;
-import org.apache.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException;
+import org.apache.guacamole.language.TranslatableGuacamoleCredentialsException;
+import org.apache.guacamole.language.TranslatableGuacamoleInsufficientCredentialsException;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -135,8 +136,8 @@ public class ConnectionManager {
JsonGroup group = groupPool.get(groupid);
if (group == null) {
// Request the user to select a group
- throw new GuacamoleInsufficientCredentialsException(
- "GROUP_SELECTION.TITLE", new CredentialsInfo(
+ throw new TranslatableGuacamoleInsufficientCredentialsException(
+ "GROUP_SELECTION.TITLE", "GROUP_SELECTION.TITLE", new CredentialsInfo(
Collections.<Field>singletonList(new GroupField())
));
}
@@ -164,8 +165,8 @@ public class ConnectionManager {
}
if (freeClient == null) {
// Request the user to select another Group
- throw new GuacamoleCredentialsException(
- "GROUP_SELECTION.NO_FREE_ERROR", new CredentialsInfo(
+ throw new TranslatableGuacamoleCredentialsException(
+ "GROUP_SELECTION.NO_FREE_ERROR", "GROUP_SELECTION.NO_FREE_ERROR", new CredentialsInfo(
Collections.<Field>singletonList(new GroupField())
));
}
@@ -217,6 +218,8 @@ public class ConnectionManager {
((HttpsURLConnection) con).setHostnameVerifier(ignorer);
((HttpsURLConnection) con).setSSLSocketFactory(sockFac);
}
+ con.setRequestProperty("Bwlp-Plugin-Build-Revision", BwlpAuthenticationProvider.MANIFEST.getProperty("Build-Revision"));
+ con.setRequestProperty("Bwlp-Plugin-Build-Timestamp", BwlpAuthenticationProvider.MANIFEST.getProperty("Build-Revision-Timestamp"));
try (BufferedInputStream in = new BufferedInputStream(con.getInputStream())) {
byte dataBuffer[] = new byte[2048];
int bytesRead;
diff --git a/src/main/resources/continue-patch.html b/src/main/resources/continue-patch.html
new file mode 100644
index 0000000..85204b6
--- /dev/null
+++ b/src/main/resources/continue-patch.html
@@ -0,0 +1,5 @@
+<meta name="replace" content=".continue-login">
+
+<input type="submit" name="login" class="continue-login"
+ ng-disabled="false"
+ value="{{ 'GROUP_SELECTION.CONTINUE' | translate }}"/> \ No newline at end of file
diff --git a/src/main/resources/guac-manifest.json b/src/main/resources/guac-manifest.json
index 565984d..fb4bfb4 100644
--- a/src/main/resources/guac-manifest.json
+++ b/src/main/resources/guac-manifest.json
@@ -6,7 +6,12 @@
"largeIcon" : "images/Logo_bwLehrpool_symbol.png",
"authProviders": ["de.bwlehrpool.bwlp_guac.BwlpAuthenticationProvider"],
"listeners" : ["de.bwlehrpool.bwlp_guac.TunnelListener"],
- "html" : [ "login-logo.html", "selection-logo.html", "secondary-logo.html" ],
+ "html" : [
+ "login-logo.html",
+ "selection-logo.html",
+ "secondary-logo.html",
+ "continue-patch.html"
+ ],
"translations" : [
"translations/en.json",
"translations/de.json"
diff --git a/src/main/resources/translations/de.json b/src/main/resources/translations/de.json
index e4212e4..e574f3c 100644
--- a/src/main/resources/translations/de.json
+++ b/src/main/resources/translations/de.json
@@ -12,6 +12,7 @@
"PASSWORD_PROTECTED": "Passwortgeschützt",
"LOG_OUT": "Ausloggen",
"PASSWORD_ERROR": "Falsches Passwort!",
- "NO_FREE_ERROR": "Keinen freien Client gefunden. Wähle einen anderen Raum aus."
+ "NO_FREE_ERROR": "Keinen freien Client gefunden. Wähle einen anderen Raum aus.",
+ "CONTINUE": "Weiter"
}
} \ No newline at end of file
diff --git a/src/main/resources/translations/en.json b/src/main/resources/translations/en.json
index 96d9b2c..2b0c0d6 100644
--- a/src/main/resources/translations/en.json
+++ b/src/main/resources/translations/en.json
@@ -12,6 +12,7 @@
"PASSWORD_PROTECTED": "Password protected",
"LOG_OUT": "Log out",
"PASSWORD_ERROR": "Wrong password!",
- "NO_FREE_ERROR": "No free client. Select another Location."
+ "NO_FREE_ERROR": "No free client. Select another Location.",
+ "CONTINUE": "Continue"
}
} \ No newline at end of file