updated libraries

This commit is contained in:
Joern Muehlencord
2021-02-21 16:30:23 +01:00
parent b129228b36
commit cd2e3b0642
5 changed files with 103 additions and 105 deletions

View File

@ -31,22 +31,8 @@ limitations under the License.
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.inversoft</groupId> <groupId>io.fusionauth</groupId>
<artifactId>prime-jwt</artifactId> <artifactId>fusionauth-jwt</artifactId>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax</groupId> <groupId>javax</groupId>

View File

@ -15,80 +15,73 @@
*/ */
package de.muehlencord.shared.jeeutil.jwt; package de.muehlencord.shared.jeeutil.jwt;
import io.fusionauth.jwt.Verifier;
import io.fusionauth.jwt.domain.JWT;
import io.fusionauth.jwt.hmac.HMACVerifier;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import org.primeframework.jwt.Verifier;
import org.primeframework.jwt.domain.JWT;
import org.primeframework.jwt.domain.JWTException;
import org.primeframework.jwt.hmac.HMACVerifier;
/** /**
*
* @author Joern Muehlencord (joern@muehlencord.de) * @author Joern Muehlencord (joern@muehlencord.de)
*/ */
public class JWTDecoder { public class JWTDecoder {
private boolean parsedSuccessfully = false; private boolean parsedSuccessfully;
private JWT jwt = null; private JWT jwt = null;
public JWTDecoder(String password, String issuer, String jwtString) throws JWTException { public JWTDecoder(String password, String issuer, String jwtString) throws JWTException {
if ((password == null) || (issuer == null) || (jwtString == null)) { if ((password == null) || (issuer == null) || (jwtString == null)) {
throw new JWTException("password, issuer and jwt must not be null"); throw new JWTException("password, issuer and jwt must not be null");
}
Verifier verifier = HMACVerifier.newVerifier(password);
// Verifier verifier = RSAVerifier.newVerifier(new String(Files.readAllBytes(Paths.get("public_key.pem"))));
try {
jwt = JWT.getDecoder().decode(jwtString, verifier);
parsedSuccessfully = jwt.issuer.equals(issuer);
} catch (JWTException ex) {
jwt = null;
}
} }
Verifier verifier = HMACVerifier.newVerifier(password);
jwt = JWT.getDecoder().decode(jwtString, verifier);
parsedSuccessfully = jwt != null && jwt.issuer.equals(issuer);
}
public String getIssuer() { public String getIssuer() {
if (jwt == null) { if (jwt == null) {
return null; return null;
} else { } else {
return jwt.issuer; return jwt.issuer;
}
} }
}
public ZonedDateTime getIssuedAt() { public ZonedDateTime getIssuedAt() {
if (jwt == null) { if (jwt == null) {
return null; return null;
} else { } else {
return jwt.issuedAt; return jwt.issuedAt;
}
} }
}
public String getSubject() { public String getSubject() {
if (jwt == null) { if (jwt == null) {
return null; return null;
} else { } else {
return jwt.subject; return jwt.subject;
}
} }
}
public String getUniqueId() { public String getUniqueId() {
if (jwt == null) { if (jwt == null) {
return null; return null;
} else { } else {
return jwt.uniqueId; return jwt.uniqueId;
}
} }
}
public ZonedDateTime getExpiration() { public ZonedDateTime getExpiration() {
if (jwt == null) { if (jwt == null) {
return null; return null;
} else { } else {
return jwt.expiration; return jwt.expiration;
}
} }
}
public boolean isValid() { public boolean isValid() {
if ((jwt == null) || (jwt.isExpired())) { if ((jwt == null) || (jwt.isExpired())) {
return false; return false;
} else { } else {
return this.parsedSuccessfully; return this.parsedSuccessfully;
}
} }
}
} }

View File

@ -15,10 +15,10 @@
*/ */
package de.muehlencord.shared.jeeutil.jwt; package de.muehlencord.shared.jeeutil.jwt;
import io.fusionauth.jwt.Signer;
import io.fusionauth.jwt.domain.JWT;
import io.fusionauth.jwt.hmac.HMACSigner;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import org.primeframework.jwt.Signer;
import org.primeframework.jwt.domain.JWT;
import org.primeframework.jwt.hmac.HMACSigner;
/** /**
* *

View File

@ -255,8 +255,28 @@ public abstract class PoiUtil {
} }
} }
public static int getIntegerValue(Row currentRow, int cellNumber) throws PoiException {
return getIntegerValue(currentRow, cellNumber, false, 0);
}
public static Integer getIntegerValue(Row currentRow, int cellNumber, boolean returnDefaultValue, Integer defaultValue) throws PoiException {
if (currentRow == null) {
throw new PoiException("Current row must not be null");
}
Cell cell = currentRow.getCell(cellNumber);
if ((PoiUtil.cellEmpty(cell)) && !returnDefaultValue) {
throw new PoiException("Cannot read cell " + cellNumber + " from row " + currentRow.getRowNum());
} else {
if (PoiUtil.cellEmpty(cell)) {
return defaultValue;
} else {
return Double.valueOf(cell.getNumericCellValue()).intValue();
}
}
}
/** /**
* remove charecters which often cause troubles in other applications - e.g. em dash (long dash) is created by Excel automatically * remove characters which often cause troubles in other applications - e.g. em dash (long dash) is created by Excel automatically
* *
* @param sourceValue the input string to execute the replacement * @param sourceValue the input string to execute the replacement
* @return sourceValue with replaced characters * @return sourceValue with replaced characters

51
pom.xml
View File

@ -104,7 +104,7 @@ limitations under the License.
<dependency> <dependency>
<groupId>commons-codec</groupId> <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>1.13</version> <version>1.15</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-net</groupId> <groupId>commons-net</groupId>
@ -114,27 +114,27 @@ limitations under the License.
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.9</version> <version>3.11</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.6</version> <version>2.8.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.7.28</version> <version>1.7.30</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId> <artifactId>slf4j-log4j12</artifactId>
<version>1.7.28</version> <version>1.7.30</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId> <artifactId>jcl-over-slf4j</artifactId>
<version>1.7.28</version> <version>1.7.30</version>
</dependency> </dependency>
<dependency> <dependency>
@ -150,44 +150,44 @@ limitations under the License.
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>2.8.5</version> <version>2.8.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId> <artifactId>jackson-annotations</artifactId>
<version>2.11.2</version> <version>2.11.3</version>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
<version>2.11.2</version> <version>2.11.3</version>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.datatype</groupId> <groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId> <artifactId>jackson-datatype-jsr310</artifactId>
<version>2.11.2</version> <version>2.11.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.shiro</groupId> <groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId> <artifactId>shiro-core</artifactId>
<version>1.4.1</version> <version>1.7.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.shiro</groupId> <groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId> <artifactId>shiro-web</artifactId>
<version>1.4.1</version> <version>1.7.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax</groupId> <groupId>javax</groupId>
<artifactId>javaee-api</artifactId> <artifactId>javaee-api</artifactId>
<version>7.0</version> <version>8.0.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax</groupId> <groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId> <artifactId>javaee-web-api</artifactId>
<version>7.0</version> <version>8.0.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -198,40 +198,39 @@ limitations under the License.
<dependency> <dependency>
<groupId>org.bouncycastle</groupId> <groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId> <artifactId>bcprov-jdk15on</artifactId>
<version>1.62</version> <version>1.68</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId> <artifactId>hibernate-core</artifactId>
<version>5.3.10.Final</version> <version>5.4.23.Final</version>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.primefaces</groupId> <groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId> <artifactId>primefaces</artifactId>
<version>7.0</version> <version>8.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.adminfaces</groupId> <groupId>com.github.adminfaces</groupId>
<artifactId>admin-template</artifactId> <artifactId>admin-template</artifactId>
<version>1.0.2</version> <version>1.2.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.omnifaces</groupId> <groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId> <artifactId>omnifaces</artifactId>
<version>3.3</version> <version>3.4.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
<version>4.0.1</version> <version>5.0.0</version>
<!-- do not upgrade to 4.1.0, see bug https://bz.apache.org/bugzilla/show_bug.cgi?id=63845 -->
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.inversoft</groupId> <groupId>io.fusionauth</groupId>
<artifactId>prime-jwt</artifactId> <artifactId>fusionauth-jwt</artifactId>
<version>2.0.0</version> <version>4.1.0</version>
</dependency> </dependency>
<!-- Dev Tools --> <!-- Dev Tools -->
@ -239,14 +238,14 @@ limitations under the License.
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<scope>provided</scope> <scope>provided</scope>
<version>1.18.12</version> <version>1.18.16</version>
</dependency> </dependency>
<!-- Testing --> <!-- Testing -->
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId> <artifactId>junit-jupiter-engine</artifactId>
<version>5.5.1</version> <version>5.7.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>