Skip to content

Commit

Permalink
Merge pull request #26 from RADAR-base/release-0.6.0
Browse files Browse the repository at this point in the history
Release 0.6.0
  • Loading branch information
blootsvoets authored Apr 14, 2021
2 parents c3aee6e + aaa9df7 commit 02aa09c
Show file tree
Hide file tree
Showing 26 changed files with 110 additions and 97 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ jobs:
with:
# Cache gradle directories
path: |
~/.gradle/caches/jars-3
~/.gradle/caches/modules-2/files-2.1/
~/.gradle/caches/modules-2/metadata-2.96/
~/.gradle/native
~/.gradle/caches
~/.gradle/wrapper
# Key for restoring and saving the cache
key: ${{ runner.os }}-gradle
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/publish_snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Has SNAPSHOT version
id: is-snapshot
run: grep "version =\\? \\?'.*-SNAPSHOT'" build.gradle

- uses: actions/setup-java@v1
with:
java-version: 11
Expand All @@ -26,10 +30,7 @@ jobs:
with:
# Cache gradle directories
path: |
~/.gradle/caches/jars-3
~/.gradle/caches/modules-2/files-2.1/
~/.gradle/caches/modules-2/metadata-2.96/
~/.gradle/native
~/.gradle/caches
~/.gradle/wrapper
# Key for restoring and saving the cache
key: ${{ runner.os }}-gradle
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ jobs:
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: |
~/.gradle/caches/jars-3
~/.gradle/caches/modules-2/files-2.1/
~/.gradle/caches/modules-2/metadata-2.96/
~/.gradle/native
~/.gradle/wrapper
~/.gradle/caches
~/.gradle/wrapper
# An explicit key for restoring and saving the cache
key: ${{ runner.os }}-gradle

Expand All @@ -51,4 +48,4 @@ jobs:
env:
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: ./gradlew -Psigning.gnupg.keyName=CBEF2CF0 -Psigning.gnupg.executable=gpg -Psigning.gnupg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} publish
run: ./gradlew -Psigning.gnupg.keyName=CBEF2CF0 -Psigning.gnupg.executable=gpg -Psigning.gnupg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} publish closeAndReleaseSonatypeStagingRepository
73 changes: 33 additions & 40 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask

plugins {
kotlin("jvm") apply false
`maven-publish`
signing
id("org.jetbrains.dokka") apply false
id("com.github.ben-manes.versions") version "0.36.0" apply false
id("io.github.gradle-nexus.publish-plugin") version "1.0.0"
}

allprojects {
group = "org.radarbase"
version = "0.6.0"
}

subprojects {
Expand All @@ -18,8 +23,6 @@ subprojects {
apply(plugin = "org.jetbrains.dokka")

val myproject = this
group = "org.radarbase"
version = "0.5.0"

val githubRepoName = "RADAR-base/radar-jersey"
val githubUrl = "https://github.com/$githubRepoName.git"
Expand All @@ -46,10 +49,14 @@ subprojects {

repositories {
mavenCentral()
jcenter()
maven(url = "https://dl.bintray.com/radar-cns/org.radarcns")
maven(url = "https://dl.bintray.com/radar-base/org.radarbase")
maven(url = "https://repo.thehyve.nl/content/repositories/snapshots")
// Temporary until Dokka is fully published on maven central.
// https://github.com/Kotlin/kotlinx.html/issues/81
maven(url = "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
}

dependencies {
val dokkaVersion: String by project
configurations["dokkaHtmlPlugin"]("org.jetbrains.dokka:kotlin-as-java-plugin:$dokkaVersion")
}

val sourcesJar by tasks.registering(Jar::class) {
Expand All @@ -59,11 +66,6 @@ subprojects {
dependsOn(classes)
}

dependencies {
val dokkaVersion: String by project
configurations["dokkaHtmlPlugin"]("org.jetbrains.dokka:kotlin-as-java-plugin:$dokkaVersion")
}

val dokkaJar by tasks.registering(Jar::class) {
from("$buildDir/dokka/javadoc")
archiveClassifier.set("javadoc")
Expand Down Expand Up @@ -103,15 +105,10 @@ subprojects {
}
}

tasks.withType<DokkaTask> {
logging.level = LogLevel.QUIET
}

val assemble by tasks
assemble.dependsOn(sourcesJar)
assemble.dependsOn(dokkaJar)


publishing {
publications {
create<MavenPublication>("mavenJar") {
Expand Down Expand Up @@ -161,27 +158,6 @@ subprojects {
}
}
}
repositories {
fun Project.propertyOrEnv(propertyName: String, envName: String): String? {
return if (hasProperty(propertyName)) {
property(propertyName)?.toString()
} else {
System.getenv(envName)
}
}

maven {
name = "OSSRH"
credentials {
username = propertyOrEnv("ossrh.user", "OSSRH_USER")
password = propertyOrEnv("ossrh.password", "OSSRH_PASSWORD")
}

val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
}
}
}

signing {
Expand All @@ -197,6 +173,23 @@ subprojects {
}
}

fun Project.propertyOrEnv(propertyName: String, envName: String): String? {
return if (hasProperty(propertyName)) {
property(propertyName)?.toString()
} else {
System.getenv(envName)
}
}

nexusPublishing {
repositories {
sonatype {
username.set(propertyOrEnv("ossrh.user", "OSSRH_USER"))
password.set(propertyOrEnv("ossrh.password", "OSSRH_PASSWORD"))
}
}
}

tasks.wrapper {
gradleVersion = "6.8.3"
gradleVersion = "7.0"
}
15 changes: 8 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,28 @@ org.gradle.jvmargs=-Xmx2000m
org.gradle.vfs.watch=true
kotlin.code.style=official

kotlinVersion=1.4.30
dokkaVersion=1.4.20
kotlinVersion=1.4.32
dokkaVersion=1.4.30

jerseyVersion=3.0.1
grizzlyVersion=3.0.0
okhttpVersion=4.9.1
junitVersion=5.7.1

hk2Version=2.6.1
managementPortalVersion=0.6.4
managementPortalVersion=0.7.0
javaJwtVersion=3.12.0
jakartaWsRsVersion=3.0.0
jakartaAnnotationVersion=2.0.0
jacksonVersion=2.12.1
jacksonVersion=2.12.3
slf4jVersion=1.7.30
jakartaXmlBindVersion=3.0.0
jakartaJaxbCoreVersion=3.0.0
jakartaJaxbRuntimeVersion=3.0.0
jakartaActivation=2.0.0
jakartaActivation=2.0.1
swaggerVersion=2.1.7

hibernateVersion=5.4.28.Final
liquibaseVersion=4.3.1
hibernateVersion=5.4.30.Final
liquibaseVersion=4.3.3
postgresVersion=42.2.19
h2Version=1.4.200
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 4 additions & 1 deletion radar-jersey/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ dependencies {
api(kotlin("stdlib-jdk8", version=kotlinVersion))

val managementPortalVersion: String by project
api("org.radarcns:radar-auth:$managementPortalVersion")
api("org.radarbase:radar-auth:$managementPortalVersion")
api("org.radarbase:managementportal-client:$managementPortalVersion")

val javaJwtVersion: String by project
implementation("com.auth0:java-jwt:$javaJwtVersion")

val jakartaWsRsVersion: String by project
api("jakarta.ws.rs:jakarta.ws.rs-api:$jakartaWsRsVersion")
val jakartaAnnotationVersion: String by project
Expand Down
13 changes: 9 additions & 4 deletions radar-jersey/src/main/kotlin/org/radarbase/jersey/auth/Auth.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
package org.radarbase.jersey.auth

import com.fasterxml.jackson.databind.JsonNode
import org.radarbase.auth.authorization.Permission
import org.radarbase.auth.token.RadarToken
import org.radarbase.jersey.exception.HttpBadRequestException
import org.radarbase.jersey.exception.HttpForbiddenException
import org.radarcns.auth.authorization.Permission
import org.radarcns.auth.token.RadarToken
import org.slf4j.LoggerFactory

interface Auth {
Expand Down Expand Up @@ -143,9 +143,14 @@ interface Auth {
get() = methodName.isAuthMethodName || declaringClass.isAuthClass

private val String.isAuthMethodName: Boolean
get() = startsWith("logPermission") || startsWith("checkPermission")
get() = startsWith("logPermission")
|| startsWith("checkPermission")
|| startsWith("invoke")

private val Class<*>.isAuthClass: Boolean
get() = isInstance(Auth::class.java) || isAnonymousClass || isLocalClass
get() = isInstance(Auth::class.java)
|| isAnonymousClass
|| isLocalClass
|| simpleName == "ReflectionHelper"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

package org.radarbase.jersey.auth

import org.radarbase.auth.exception.TokenValidationException
import org.radarbase.jersey.auth.filter.AuthenticationFilter
import org.radarcns.auth.exception.TokenValidationException
import jakarta.ws.rs.container.ContainerRequestContext
import kotlin.jvm.Throws

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

package org.radarbase.jersey.auth

import org.radarcns.auth.authorization.Permission
import org.radarbase.auth.authorization.Permission

/**
* Indicates that a method needs an authenticated user that has a certain permission.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package org.radarbase.jersey.auth.disabled

import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import org.radarbase.auth.authorization.Permission
import org.radarbase.auth.token.RadarToken
import org.radarbase.jersey.auth.Auth
import org.radarcns.auth.authorization.Permission
import org.radarcns.auth.token.RadarToken
import java.util.*

/** Authorization that grants permission to all resources. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

package org.radarbase.jersey.auth.filter

import org.radarbase.auth.exception.TokenValidationException
import org.radarbase.jersey.auth.AuthValidator
import org.radarbase.jersey.auth.Authenticated
import org.radarbase.jersey.exception.HttpUnauthorizedException
import org.radarcns.auth.exception.TokenValidationException
import jakarta.annotation.Priority
import jakarta.inject.Singleton
import jakarta.ws.rs.Priorities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

package org.radarbase.jersey.auth.filter

import org.radarbase.auth.authorization.Permission
import org.radarbase.jersey.auth.Auth
import org.radarbase.jersey.auth.NeedsPermission
import org.radarbase.jersey.exception.HttpForbiddenException
import org.radarbase.jersey.service.ProjectService
import org.radarcns.auth.authorization.Permission
import jakarta.ws.rs.container.ContainerRequestContext
import jakarta.ws.rs.container.ContainerRequestFilter
import jakarta.ws.rs.container.ResourceInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import com.auth0.jwt.algorithms.Algorithm
import com.auth0.jwt.exceptions.AlgorithmMismatchException
import com.auth0.jwt.exceptions.JWTVerificationException
import com.auth0.jwt.exceptions.SignatureVerificationException
import org.radarbase.auth.exception.ConfigurationException
import org.radarbase.jersey.auth.Auth
import org.radarbase.jersey.auth.AuthConfig
import org.radarbase.jersey.auth.AuthValidator
import org.radarcns.auth.exception.ConfigurationException
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.nio.file.Files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ package org.radarbase.jersey.auth.jwt
import com.auth0.jwt.interfaces.DecodedJWT
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import org.radarbase.auth.authorization.Permission
import org.radarbase.auth.authorization.Permission.Entity
import org.radarbase.auth.token.JwtRadarToken
import org.radarbase.auth.token.RadarToken
import org.radarbase.jersey.auth.Auth
import org.radarcns.auth.authorization.Permission
import org.radarcns.auth.authorization.Permission.Entity
import org.radarcns.auth.token.JwtRadarToken
import org.radarcns.auth.token.RadarToken

/**
* Parsed JWT for validating authorization of data contents.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ package org.radarbase.jersey.auth.managementportal

import com.auth0.jwt.interfaces.DecodedJWT
import com.fasterxml.jackson.databind.JsonNode
import org.radarbase.auth.authorization.Permission.MEASUREMENT_CREATE
import org.radarbase.auth.token.JwtRadarToken
import org.radarbase.auth.token.RadarToken
import org.radarbase.jersey.auth.Auth
import org.radarcns.auth.authorization.Permission.MEASUREMENT_CREATE
import org.radarcns.auth.token.JwtRadarToken
import org.radarcns.auth.token.RadarToken

/**
* Parsed JWT for validating authorization of data contents.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
package org.radarbase.jersey.auth.managementportal

import com.auth0.jwt.JWT
import org.radarbase.auth.authentication.TokenValidator
import org.radarbase.auth.exception.TokenValidationException
import org.radarbase.jersey.auth.Auth
import org.radarbase.jersey.auth.AuthValidator
import org.radarcns.auth.authentication.TokenValidator
import org.radarcns.auth.exception.TokenValidationException
import org.slf4j.LoggerFactory
import jakarta.ws.rs.container.ContainerRequestContext
import jakarta.ws.rs.core.Context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

package org.radarbase.jersey.auth.managementportal

import org.radarbase.auth.authentication.TokenValidator
import org.radarbase.auth.config.TokenVerifierPublicKeyConfig
import org.radarbase.jersey.auth.AuthConfig
import org.radarcns.auth.authentication.TokenValidator
import org.radarcns.auth.config.TokenVerifierPublicKeyConfig
import java.net.URI
import java.util.function.Supplier
import jakarta.ws.rs.core.Context
Expand Down
Loading

0 comments on commit 02aa09c

Please sign in to comment.