diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 450137d6..4dfc4809 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,9 @@ # Authentication Service MKII release notes +## 0.7.1 + +* Publishes a shadow jar on jitpack.io for supporting tests in other repos. + ## 0.7.0 * BACKWARDS INCOMPATIBILITY - the auth server now logs to stdout vs. syslog. diff --git a/build.gradle b/build.gradle index 853bc303..7b4db7ee 100644 --- a/build.gradle +++ b/build.gradle @@ -6,12 +6,24 @@ plugins { id 'java' id 'war' id 'jacoco' + id 'maven-publish' id 'org.ajoberstar.grgit' version '4.1.1' id 'com.github.johnrengelman.shadow' version '8.1.1' } +group = 'com.github.kbase' + repositories { mavenCentral() + + maven { + name = "Clojars" + url = "https://repo.clojars.org/" + } + maven { + name = "JitPack" + url = 'https://jitpack.io' + } } // Warning - these values are hard coded in AuthController.java def JAR_TEMPLATE_DIR = 'kbase_auth2_templates' @@ -132,23 +144,17 @@ java -cp build/classes/java/main:\$CLASSPATH us.kbase.auth2.cli.AuthCLI \$@ } } -def fromURL = { url, name -> - File file = new File("$buildDir/download/${name}.jar") - file.parentFile.mkdirs() - if (!file.exists()) { - new URL(url).withInputStream { downloadStream -> - file.withOutputStream { fileOut -> - fileOut << downloadStream - } +publishing { + publications { + shadow(MavenPublication) { publication -> + project.shadow.component(publication) + artifactId = "auth2-test-shadow-all" } } - files(file.absolutePath) } dependencies { - // ### General application dependencies ### - /* Notes on exclusions: * Bizarrely, the glassfish verison of inject has a dependency on v1 inject, which * causes problems when trying to build the fat jar @@ -167,6 +173,20 @@ dependencies { implementation 'org.mongodb:mongodb-driver-sync:4.11.1' implementation 'org.mongodb:bson-record-codec:4.11.1' implementation 'org.mongodb:bson:4.11.1' + implementation('com.github.kbase:java_common:0.3.0') { + exclude group: 'net.java.dev.jna' // breaks shadow jar + exclude group: 'org.eclipse.jetty.aggregate' // ugh, java common pollutes everything + exclude group: 'com.fasterxml.jackson.core' // breaks everything if we upgrade + exclude group: 'javax.servlet', module: 'servlet-api' // 2.5 vs 3.1 below + // I have no idea why, but including the auth client in the build causes the shadow + // jar to fail to start correctly. It shouldn't be a problem, but it is + exclude group: 'com.github.kbase', module: 'auth2_client_java' + } + implementation 'ch.qos.logback:logback-classic:1.1.2' + implementation 'org.slf4j:slf4j-api:1.7.25' + // TODO DEPS Need to rework the java common logger to not use syslog4j at all since it's + // abandonware and has a ton of CVEs, even in the newer versions. + implementation "org.syslog4j:syslog4j:0.9.46" implementation 'com.github.spullara.mustache.java:compiler:0.9.3' implementation 'com.nulab-inc:zxcvbn:1.2.2' implementation 'nl.basjes.parse.useragent:yauaa:1.3' @@ -192,28 +212,6 @@ dependencies { implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359' - // ### Logging dependencies ### - implementation fromURL( - 'https://github.com/kbase/jars/raw/master/lib/jars/kbase/common/kbase-common-0.2.0.jar', - 'kbase-common-0.2.0' - ) - implementation 'ch.qos.logback:logback-classic:1.1.2' - implementation 'org.slf4j:slf4j-api:1.7.25' - // Syslog4j 0.9.46 doesn't appear to be available on Maven. It apparently lives in - // a JetBrains artifact server, but that's too much trouble and there's only one version there - // anyway. - // https://mvnrepository.com/artifact/org.jetbrains/syslog4j/0.9.46 - // Need to rework the java common logger to not use syslog4j at all since it's abandonware - // and has a ton of CVEs, even in the newer versions. - implementation fromURL( - 'https://github.com/kbase/jars/raw/master/lib/jars/syslog4j/syslog4j-0.9.46.jar', - 'syslog4j-0.9.46' - ) - // needed for syslog4j - implementation 'joda-time:joda-time:2.3' - - // ### Test ### - testImplementation 'commons-io:commons-io:2.4' testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.1.10' testImplementation 'junit:junit:4.12' @@ -229,6 +227,9 @@ dependencies { testImplementation 'de.danielbechler:java-object-diff:0.94' testImplementation 'org.jsoup:jsoup:1.10.2' testImplementation 'org.mockito:mockito-core:3.0.0' + testImplementation('com.github.kbase:java_test_utilities:0.1.0') { + exclude group: 'com.fasterxml.jackson.core' // upgrading breaks stuff + } } task showTestClassPath { diff --git a/src/main/java/us/kbase/auth2/Version.java b/src/main/java/us/kbase/auth2/Version.java index b90353b9..30993a69 100644 --- a/src/main/java/us/kbase/auth2/Version.java +++ b/src/main/java/us/kbase/auth2/Version.java @@ -5,6 +5,6 @@ public class Version { /** The version of the KBase Auth2 service. */ - public static final String VERSION = "0.7.0"; + public static final String VERSION = "0.7.1"; } diff --git a/src/test/java/us/kbase/test/auth2/MongoStorageTestManager.java b/src/test/java/us/kbase/test/auth2/MongoStorageTestManager.java index 58776004..36f9d9db 100644 --- a/src/test/java/us/kbase/test/auth2/MongoStorageTestManager.java +++ b/src/test/java/us/kbase/test/auth2/MongoStorageTestManager.java @@ -21,7 +21,7 @@ import us.kbase.auth2.cryptutils.RandomDataGenerator; import us.kbase.auth2.lib.storage.mongo.MongoStorage; -import us.kbase.common.test.controllers.mongo.MongoController; +import us.kbase.testutils.controllers.mongo.MongoController; public class MongoStorageTestManager { diff --git a/src/test/java/us/kbase/test/auth2/TestCommon.java b/src/test/java/us/kbase/test/auth2/TestCommon.java index abd9cff3..f98b0db0 100644 --- a/src/test/java/us/kbase/test/auth2/TestCommon.java +++ b/src/test/java/us/kbase/test/auth2/TestCommon.java @@ -39,7 +39,7 @@ import us.kbase.auth2.lib.TemporarySessionData; import us.kbase.auth2.lib.UserName; import us.kbase.auth2.lib.token.TemporaryToken; -import us.kbase.common.test.TestException; +import us.kbase.testutils.TestException; public class TestCommon { diff --git a/src/test/java/us/kbase/test/auth2/authcontroller/AuthController.java b/src/test/java/us/kbase/test/auth2/authcontroller/AuthController.java index 8588c6e7..43abe22e 100644 --- a/src/test/java/us/kbase/test/auth2/authcontroller/AuthController.java +++ b/src/test/java/us/kbase/test/auth2/authcontroller/AuthController.java @@ -1,7 +1,7 @@ package us.kbase.test.auth2.authcontroller; -import static us.kbase.common.test.controllers.ControllerCommon.findFreePort; -import static us.kbase.common.test.controllers.ControllerCommon.makeTempDirs; +import static us.kbase.testutils.controllers.ControllerCommon.findFreePort; +import static us.kbase.testutils.controllers.ControllerCommon.makeTempDirs; import static us.kbase.test.auth2.TestConfigurator.MONGO_HOST_KEY; import static us.kbase.test.auth2.TestConfigurator.MONGO_DB_KEY; import static us.kbase.test.auth2.TestConfigurator.MONGO_TEMPLATES_KEY; @@ -27,7 +27,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; -import us.kbase.common.test.TestException; +import us.kbase.testutils.TestException; import us.kbase.test.auth2.StandaloneAuthServer; /** Q&D utility to run the auth server in test mode for use in testing rigs. Expected to diff --git a/src/test/java/us/kbase/test/auth2/lib/storage/mongo/MongoStorageTester.java b/src/test/java/us/kbase/test/auth2/lib/storage/mongo/MongoStorageTester.java index 94f6c902..5297072d 100644 --- a/src/test/java/us/kbase/test/auth2/lib/storage/mongo/MongoStorageTester.java +++ b/src/test/java/us/kbase/test/auth2/lib/storage/mongo/MongoStorageTester.java @@ -12,8 +12,8 @@ import us.kbase.auth2.cryptutils.RandomDataGenerator; import us.kbase.auth2.lib.storage.mongo.MongoStorage; -import us.kbase.common.test.controllers.mongo.MongoController; import us.kbase.test.auth2.MongoStorageTestManager; +import us.kbase.testutils.controllers.mongo.MongoController; public class MongoStorageTester { diff --git a/src/test/java/us/kbase/test/auth2/service/LoggingFilterTest.java b/src/test/java/us/kbase/test/auth2/service/LoggingFilterTest.java index 2c79f2ce..093e7856 100644 --- a/src/test/java/us/kbase/test/auth2/service/LoggingFilterTest.java +++ b/src/test/java/us/kbase/test/auth2/service/LoggingFilterTest.java @@ -42,10 +42,10 @@ import us.kbase.auth2.service.AuthStartupConfig; import us.kbase.auth2.service.LoggingFilter; import us.kbase.auth2.service.SLF4JAutoLogger; -import us.kbase.common.test.RegexMatcher; import us.kbase.test.auth2.MongoStorageTestManager; import us.kbase.test.auth2.StandaloneAuthServer; import us.kbase.test.auth2.TestCommon; +import us.kbase.testutils.RegexMatcher; import us.kbase.test.auth2.StandaloneAuthServer.ServerThread; public class LoggingFilterTest { diff --git a/src/test/java/us/kbase/test/auth2/service/ServiceTestUtils.java b/src/test/java/us/kbase/test/auth2/service/ServiceTestUtils.java index 8db5e7cc..80b24f60 100644 --- a/src/test/java/us/kbase/test/auth2/service/ServiceTestUtils.java +++ b/src/test/java/us/kbase/test/auth2/service/ServiceTestUtils.java @@ -57,10 +57,10 @@ import us.kbase.auth2.lib.token.TokenName; import us.kbase.auth2.lib.token.TokenType; import us.kbase.auth2.service.AuthExternalConfig; -import us.kbase.common.test.RegexMatcher; import us.kbase.test.auth2.MockIdentityProviderFactory; import us.kbase.test.auth2.MongoStorageTestManager; import us.kbase.test.auth2.TestCommon; +import us.kbase.testutils.RegexMatcher; public class ServiceTestUtils { diff --git a/src/test/java/us/kbase/test/auth2/service/common/ServiceCommonTest.java b/src/test/java/us/kbase/test/auth2/service/common/ServiceCommonTest.java index 350e8987..bf662eb9 100644 --- a/src/test/java/us/kbase/test/auth2/service/common/ServiceCommonTest.java +++ b/src/test/java/us/kbase/test/auth2/service/common/ServiceCommonTest.java @@ -47,7 +47,7 @@ public class ServiceCommonTest { public static final String SERVICE_NAME = "Authentication Service"; - public static final String SERVER_VER = "0.7.0"; + public static final String SERVER_VER = "0.7.1"; public static final String GIT_ERR = "Missing git commit file gitcommit, should be in us.kbase.auth2"; diff --git a/src/test/java/us/kbase/test/auth2/service/ui/LoginTest.java b/src/test/java/us/kbase/test/auth2/service/ui/LoginTest.java index 6fe6957a..97c18ae9 100644 --- a/src/test/java/us/kbase/test/auth2/service/ui/LoginTest.java +++ b/src/test/java/us/kbase/test/auth2/service/ui/LoginTest.java @@ -79,7 +79,6 @@ import us.kbase.auth2.lib.user.AuthUser; import us.kbase.auth2.lib.user.LocalUser; import us.kbase.auth2.lib.user.NewUser; -import us.kbase.common.test.RegexMatcher; import us.kbase.test.auth2.MapBuilder; import us.kbase.test.auth2.MockIdentityProviderFactory; import us.kbase.test.auth2.MongoStorageTestManager; @@ -87,6 +86,7 @@ import us.kbase.test.auth2.TestCommon; import us.kbase.test.auth2.StandaloneAuthServer.ServerThread; import us.kbase.test.auth2.service.ServiceTestUtils; +import us.kbase.testutils.RegexMatcher; public class LoginTest { diff --git a/src/test/java/us/kbase/test/auth2/service/ui/PKCEChallengeMatcher.java b/src/test/java/us/kbase/test/auth2/service/ui/PKCEChallengeMatcher.java index 7233c3af..a705b493 100644 --- a/src/test/java/us/kbase/test/auth2/service/ui/PKCEChallengeMatcher.java +++ b/src/test/java/us/kbase/test/auth2/service/ui/PKCEChallengeMatcher.java @@ -4,7 +4,8 @@ import org.mockito.ArgumentMatcher; -import us.kbase.common.test.RegexMatcher; +import us.kbase.testutils.RegexMatcher; + public class PKCEChallengeMatcher implements ArgumentMatcher { diff --git a/src/test/java/us/kbase/test/auth2/service/ui/StateMatcher.java b/src/test/java/us/kbase/test/auth2/service/ui/StateMatcher.java index e74f0f69..7d62e2dc 100644 --- a/src/test/java/us/kbase/test/auth2/service/ui/StateMatcher.java +++ b/src/test/java/us/kbase/test/auth2/service/ui/StateMatcher.java @@ -4,7 +4,8 @@ import org.mockito.ArgumentMatcher; -import us.kbase.common.test.RegexMatcher; +import us.kbase.testutils.RegexMatcher; + public class StateMatcher implements ArgumentMatcher {