Skip to content

Bump deps #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ repositories {
}

group = 'net.tokensmith'
version = '1.3.4'
version = '1.3.5-SNAPSHOT'
description = 'Java implementation of JWT'

sourceCompatibility = 12
targetCompatibility = 12

ext {
jacksonVersion = '2.11.0'
log4jVersion = '2.13.3'
slf4jVersion = '1.7.25'
jacksonVersion = '2.12.0'
log4jVersion = '2.14.0'
slf4jVersion = '1.7.30'
mockitoVersion = '2.28.2'
}

Expand All @@ -30,26 +30,25 @@ dependencies {
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${jacksonVersion}"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jacksonVersion}"

compile group: 'org.slf4j', name: 'slf4j-api', version: "${slf4jVersion}"
implementation group: 'org.slf4j', name: 'slf4j-api', version: "${slf4jVersion}"

testImplementation group: 'junit', name: 'junit', version:'4.12'
testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version:'1.3'
testCompile "org.mockito:mockito-core:${mockitoVersion}"
testCompile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: "${log4jVersion}"
testCompile group: 'org.apache.logging.log4j', name: 'log4j-api', version: "${log4jVersion}"
testCompile group: 'org.apache.logging.log4j', name: 'log4j-core', version: "${log4jVersion}"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: "${log4jVersion}"
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: "${log4jVersion}"
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: "${log4jVersion}"
}



task sourcesJar(type: Jar) {
classifier = 'sources'
archiveClassifier = 'sources'
from(sourceSets.main.allJava)
}

task javadocJar(type: Jar) {
classifier = 'javadoc'
archiveClassifier = 'javadoc'
from(javadoc.destinationDir)
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
4 changes: 2 additions & 2 deletions src/main/java/net/tokensmith/jwt/config/JwtAppFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import net.tokensmith.jwt.entity.jwk.Key;
import net.tokensmith.jwt.entity.jwk.RSAPublicKey;
Expand Down Expand Up @@ -62,7 +62,7 @@ public ObjectMapper objectMapper() {
if (objectMapper == null) {
this.objectMapper = new ObjectMapper()
.setPropertyNamingStrategy(
PropertyNamingStrategy.SNAKE_CASE
PropertyNamingStrategies.SNAKE_CASE
)
.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true)
.registerModule(new Jdk8Module())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
import java.util.Optional;
import java.util.UUID;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.*;


public class EncryptedCompactBuilderTest {
private static JwtAppFactory jwtAppFactory = new JwtAppFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.Optional;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;

public class SecureCompactBuilderTest {
private SecureCompactBuilder subject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

import java.io.ByteArrayOutputStream;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;


public class UnsecureCompactBuilderTest {
private UnsecureCompactBuilder subject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import java.math.BigInteger;
import java.util.Optional;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;


public class RSAKeyPairTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import java.math.BigInteger;
import java.util.Optional;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class RSAPublicKeyTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import org.junit.Test;

import java.math.BigInteger;
import java.util.Optional;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;


public class SymmetricKeyTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@

import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;

import static org.junit.Assert.assertThat;



public class SecureJwtFactoryTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@

import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;


/**
* Created by tommackenzie on 8/11/15.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;

public class CipherRSAFactoryTest {
private PublicKeyTranslator publicKeyTranslator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;


public class CipherSymmetricFactoryTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;

public class SecretKeyGeneratorTest {
private SecretKeyGenerator subject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;

public class JweDirectDesializerTest {
private static JwtAppFactory jwtAppFactory = new JwtAppFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;


public class JweDirectSerializerTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;


public class JweRsaDeserializerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;

public class JweRsaSerializerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;

public class PrivateKeyTranslatorTest {
private PrivateKeyTranslator subject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;

public class PublicKeyTranslatorTest {
private JwtAppFactory appFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;


public class KeyGeneratorTest {
private static final JwtAppFactory jwtAppFactory = new JwtAppFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
import java.io.ByteArrayOutputStream;
import java.util.Optional;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;



public class SecureJwtSerializerTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
import org.junit.Before;
import org.junit.Test;
import net.tokensmith.jwt.config.JwtAppFactory;
import net.tokensmith.jwt.jws.signer.factory.exception.InvalidAlgorithmException;
import net.tokensmith.jwt.jws.signer.factory.exception.InvalidJsonWebKeyException;


import java.util.Optional;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;


/**
* Created by tommackenzie on 8/19/15.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import java.util.Optional;

import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;

/**
* Created by tommackenzie on 11/12/15.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
import org.junit.Test;
import net.tokensmith.jwt.config.JwtAppFactory;
import net.tokensmith.jwt.jws.signer.SignAlgorithm;
import net.tokensmith.jwt.jws.signer.factory.exception.InvalidAlgorithmException;
import net.tokensmith.jwt.jws.signer.factory.hmac.MacFactory;
import net.tokensmith.jwt.jws.signer.factory.hmac.exception.SecurityKeyException;

import javax.crypto.Mac;
import java.util.Base64;

import static org.junit.Assert.*;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertNotNull;

/**
* Created by tommackenzie on 8/22/15.
Expand All @@ -34,10 +35,10 @@ public void makeKeyShouldBeHS256WithSecretKey() throws Exception {

java.security.Key actual = subject.makeKey(SignAlgorithm.HS256, key);
assertNotNull(actual);
assertEquals(actual.getAlgorithm(), SignAlgorithm.HS256.getJdkAlgorithm());
assertThat(actual.getAlgorithm(), is(SignAlgorithm.HS256.getJdkAlgorithm()));

Base64.Encoder encoder = Base64.getUrlEncoder().withoutPadding();
assertEquals(encoder.encodeToString(actual.getEncoded()), key.getKey());
assertThat(encoder.encodeToString(actual.getEncoded()), is(key.getKey()));
}

@Test
Expand All @@ -46,6 +47,6 @@ public void makeMacShouldBeHS256Alg() throws Exception {

Mac actual = subject.makeMac(SignAlgorithm.HS256, key);
assertNotNull(actual);
assertEquals(actual.getAlgorithm(), SignAlgorithm.HS256.getJdkAlgorithm());
assertThat(actual.getAlgorithm(), is(SignAlgorithm.HS256.getJdkAlgorithm()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
import java.security.interfaces.RSAPrivateCrtKey;

import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;


/**
* Created by tommackenzie on 11/6/15.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
import java.security.Signature;

import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;


/**
* Created by tommackenzie on 11/14/15.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
import net.tokensmith.jwt.jws.signer.factory.exception.InvalidAlgorithmException;
import net.tokensmith.jwt.jws.signer.factory.exception.InvalidJsonWebKeyException;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.junit.Assert.*;


/**
* Created by tommackenzie on 8/31/15.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
import org.junit.Test;
import net.tokensmith.jwt.config.JwtAppFactory;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;


/**
* Created by tommackenzie on 11/14/15.
Expand Down
Loading