diff --git a/README.md b/README.md index 98f5fc2..9e31424 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,17 @@ Talks to: * Dolby CP750 * Jnior 310 +## Prerequisites +[purejavacomm](https://github.com/nyholku/purejavacomm) doesn't have version 1.0.4 on maven central. That version fixes compatibility with Java 11+ and is required to run in a modern JVM. + +Install the version 1.0.4 locally, so the dependency is picked up when building the kinoapi +```shell +git clone https://github.com/nyholku/purejavacomm +cd purejavacomm +git checkout dafb397 +mvn install +``` + ## Usage Use Maven 3 to build. diff --git a/pom.xml b/pom.xml index efed1ac..7f0fa56 100644 --- a/pom.xml +++ b/pom.xml @@ -16,39 +16,39 @@ org.java-websocket Java-WebSocket - 1.5.4 + 1.5.7 org.slf4j slf4j-simple - 1.7.36 + 2.0.16 com.google.code.gson gson - 2.10.1 + 2.11.0 compile com.github.purejavacomm purejavacomm - 1.0.2.RELEASE + 1.0.4 io.jsonwebtoken jjwt-api - 0.11.5 + 0.12.6 io.jsonwebtoken jjwt-impl - 0.11.5 + 0.12.6 runtime io.jsonwebtoken jjwt-jackson - 0.11.5 + 0.12.6 runtime @@ -82,16 +82,15 @@ org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + 3.13.0 - 1.8 - 1.8 + 16 org.codehaus.mojo exec-maven-plugin - 3.1.0 + 3.5.0 diff --git a/src/main/java/de/schunterkino/kinoapi/websocket/CinemaWebSocketServer.java b/src/main/java/de/schunterkino/kinoapi/websocket/CinemaWebSocketServer.java index d0c9eff..8030b9b 100644 --- a/src/main/java/de/schunterkino/kinoapi/websocket/CinemaWebSocketServer.java +++ b/src/main/java/de/schunterkino/kinoapi/websocket/CinemaWebSocketServer.java @@ -76,6 +76,7 @@ import io.jsonwebtoken.ExpiredJwtException; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.io.Decoders; +import io.jsonwebtoken.security.Keys; /** * WebSocket server class which serves the documented JSON API. This class acts @@ -208,8 +209,9 @@ private void validateToken(ClientHandshake request) throws InvalidDataException // because. try { Jwts.parser().requireSubject("SchunterKinoRemote") - .setSigningKey(Decoders.BASE64.decode(App.getConfigurationString("jws_signature_key"))) - .parseClaimsJws(compactJws); + .verifyWith(Keys.hmacShaKeyFor(Decoders.BASE64.decode(App.getConfigurationString("jws_signature_key")))) + .build() + .parseSignedClaims(compactJws); } catch (ExpiredJwtException e) { System.err.println("Expired! " + e.getMessage()); // e.printStackTrace();