diff --git a/.gitignore b/.gitignore
index 1d9336b..4f1f1c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,4 +23,5 @@
hs_err_pid*
.idea
-**.iml
\ No newline at end of file
+**.iml
+target
\ No newline at end of file
diff --git a/oauth2-server-client-inmemory/pom.xml b/oauth2-server-client-inmemory/pom.xml
index 4b27196..5e81308 100644
--- a/oauth2-server-client-inmemory/pom.xml
+++ b/oauth2-server-client-inmemory/pom.xml
@@ -5,7 +5,7 @@
kotlin-oauth2-server
nl.myndocs
- 0.7.1
+ 0.7.2-SNAPSHOT
4.0.0
diff --git a/oauth2-server-core/pom.xml b/oauth2-server-core/pom.xml
index 8eaa0b6..a95e628 100644
--- a/oauth2-server-core/pom.xml
+++ b/oauth2-server-core/pom.xml
@@ -5,7 +5,7 @@
kotlin-oauth2-server
nl.myndocs
- 0.7.1
+ 0.7.2-SNAPSHOT
4.0.0
diff --git a/oauth2-server-hexagon/pom.xml b/oauth2-server-hexagon/pom.xml
index 9eb9112..57f5ba2 100644
--- a/oauth2-server-hexagon/pom.xml
+++ b/oauth2-server-hexagon/pom.xml
@@ -5,7 +5,7 @@
kotlin-oauth2-server
nl.myndocs
- 0.7.1
+ 0.7.2-SNAPSHOT
4.0.0
diff --git a/oauth2-server-http4k/pom.xml b/oauth2-server-http4k/pom.xml
index ad11983..58127a7 100644
--- a/oauth2-server-http4k/pom.xml
+++ b/oauth2-server-http4k/pom.xml
@@ -5,7 +5,7 @@
kotlin-oauth2-server
nl.myndocs
- 0.7.1
+ 0.7.2-SNAPSHOT
4.0.0
@@ -15,13 +15,13 @@
org.http4k
http4k-core
- 3.37.1
+ 4.25.13.0
provided
org.http4k
http4k-server-jetty
- 3.37.1
+ 4.25.13.0
test
diff --git a/oauth2-server-identity-inmemory/pom.xml b/oauth2-server-identity-inmemory/pom.xml
index d325e43..8e9be0c 100644
--- a/oauth2-server-identity-inmemory/pom.xml
+++ b/oauth2-server-identity-inmemory/pom.xml
@@ -5,7 +5,7 @@
kotlin-oauth2-server
nl.myndocs
- 0.7.1
+ 0.7.2-SNAPSHOT
4.0.0
diff --git a/oauth2-server-integration-base/pom.xml b/oauth2-server-integration-base/pom.xml
index 50345f0..8a6e5b8 100644
--- a/oauth2-server-integration-base/pom.xml
+++ b/oauth2-server-integration-base/pom.xml
@@ -5,28 +5,28 @@
kotlin-oauth2-server
nl.myndocs
- 0.7.1
+ 0.7.2-SNAPSHOT
4.0.0
oauth2-server-integration-base
- 2.11.4
- 2.11.4
+ 2.13.3
+ 2.13.3
com.squareup.okhttp3
okhttp
- 3.12.1
+ 4.9.3
org.junit.jupiter
junit-jupiter-engine
- 5.2.0
+ 5.8.2
provided
diff --git a/oauth2-server-integration-base/src/main/java/nl/myndocs/oauth2/integration/BaseIntegrationTest.kt b/oauth2-server-integration-base/src/main/java/nl/myndocs/oauth2/integration/BaseIntegrationTest.kt
index c021ab4..cb4ad36 100644
--- a/oauth2-server-integration-base/src/main/java/nl/myndocs/oauth2/integration/BaseIntegrationTest.kt
+++ b/oauth2-server-integration-base/src/main/java/nl/myndocs/oauth2/integration/BaseIntegrationTest.kt
@@ -61,7 +61,7 @@ abstract class BaseIntegrationTest {
val response = client.newCall(request)
.execute()
- val values = objectMapper.readMap(response.body()!!.string())
+ val values = objectMapper.readMap(response.body!!.string())
assertThat(values["access_token"], `is`(notNullValue()))
assertThat(UUID.fromString(values["access_token"] as String), `is`(instanceOf(UUID::class.java)))
@@ -98,25 +98,31 @@ abstract class BaseIntegrationTest {
response.close()
- val body = FormBody.Builder()
+ val body = response.header("location")!!.asQueryParameters()["code"]?.let {
+ FormBody.Builder()
.add("grant_type", "authorization_code")
- .add("code", response.header("location")!!.asQueryParameters()["code"])
+ .add("code", it)
.add("redirect_uri", "http://localhost:8080/callback")
.add("client_id", "testapp")
.add("client_secret", "testpass")
.build()
+ }
val tokenUrl = buildOauthTokenUri()
- val tokenRequest = Request.Builder()
+ val tokenRequest = body?.let {
+ Request.Builder()
.url(tokenUrl)
- .post(body)
+ .post(it)
.build()
+ }
- val tokenResponse = client.newCall(tokenRequest)
+ val tokenResponse = tokenRequest?.let {
+ client.newCall(it)
.execute()
+ }
- val values = objectMapper.readMap(tokenResponse.body()!!.string())
+ val values = objectMapper.readMap(tokenResponse?.body!!.string())
assertThat(values["access_token"], `is`(notNullValue()))
assertThat(UUID.fromString(values["access_token"] as String), `is`(instanceOf(UUID::class.java)))
@@ -140,7 +146,7 @@ abstract class BaseIntegrationTest {
val tokenResponse = client.newCall(tokenRequest)
.execute()
- val values = objectMapper.readMap(tokenResponse.body()!!.string())
+ val values = objectMapper.readMap(tokenResponse.body!!.string())
assertThat(values["access_token"], `is`(notNullValue()))
assertThat(UUID.fromString(values["access_token"] as String), `is`(instanceOf(UUID::class.java)))
diff --git a/oauth2-server-javalin/pom.xml b/oauth2-server-javalin/pom.xml
index dbcf995..5e6ebf2 100644
--- a/oauth2-server-javalin/pom.xml
+++ b/oauth2-server-javalin/pom.xml
@@ -5,7 +5,7 @@
kotlin-oauth2-server
nl.myndocs
- 0.7.1
+ 0.7.2-SNAPSHOT
4.0.0
@@ -21,7 +21,7 @@
io.javalin
javalin
- 3.12.0
+ 4.5.0
provided
diff --git a/oauth2-server-json/pom.xml b/oauth2-server-json/pom.xml
index af0bca1..4a69956 100644
--- a/oauth2-server-json/pom.xml
+++ b/oauth2-server-json/pom.xml
@@ -5,7 +5,7 @@
kotlin-oauth2-server
nl.myndocs
- 0.7.1
+ 0.7.2-SNAPSHOT
4.0.0
@@ -15,7 +15,7 @@
com.google.code.gson
gson
- 2.8.9
+ 2.9.0
diff --git a/oauth2-server-jwt/pom.xml b/oauth2-server-jwt/pom.xml
index 3daae14..37a99e2 100644
--- a/oauth2-server-jwt/pom.xml
+++ b/oauth2-server-jwt/pom.xml
@@ -5,7 +5,7 @@
kotlin-oauth2-server
nl.myndocs
- 0.7.1
+ 0.7.2-SNAPSHOT
4.0.0
@@ -21,7 +21,7 @@
com.auth0
java-jwt
- 3.5.0
+ 3.19.2
\ No newline at end of file
diff --git a/oauth2-server-ktor/pom.xml b/oauth2-server-ktor/pom.xml
index e4a95d1..f652ddf 100644
--- a/oauth2-server-ktor/pom.xml
+++ b/oauth2-server-ktor/pom.xml
@@ -5,20 +5,20 @@
kotlin-oauth2-server
nl.myndocs
- 0.7.1
+ 0.7.2-SNAPSHOT
4.0.0
oauth2-server-ktor
- 1.1.2
+ 2.0.1
io.ktor
- ktor-server-core
+ ktor-server-core-jvm
${ktor.version}
provided
@@ -37,7 +37,7 @@
io.ktor
- ktor-server-netty
+ ktor-server-netty-jvm
${ktor.version}
test
@@ -47,20 +47,48 @@
${project.version}
test
+
+ io.ktor
+ ktor-utils-jvm
+ ${ktor.version}
+ provided
+
+
+ io.ktor
+ ktor-server-host-common-jvm
+ ${ktor.version}
+ provided
+
ktor
- http://dl.bintray.com/kotlin/ktor
+ https://kotlin.bintray.com/ktor
kotlinx
- http://dl.bintray.com/kotlin/kotlinx
+ https://kotlin.bintray.com/kotlinx
+
+
+ central
+ https://repo1.maven.org/maven2/
+
+
+ jitpack
+ https://jitpack.io
+
+
+ ktor-eap
+ https://maven.pkg.jetbrains.space/public/p/ktor/eap
+
+
+ ktor-dev
+ https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev
- jcenter
- http://jcenter.bintray.com
+ central1
+ https://repo.maven.apache.org/maven2
\ No newline at end of file
diff --git a/oauth2-server-ktor/src/main/java/nl/myndocs/oauth2/ktor/feature/Oauth2ServerFeature.kt b/oauth2-server-ktor/src/main/java/nl/myndocs/oauth2/ktor/feature/Oauth2ServerFeature.kt
index 6cd8960..24e44d6 100644
--- a/oauth2-server-ktor/src/main/java/nl/myndocs/oauth2/ktor/feature/Oauth2ServerFeature.kt
+++ b/oauth2-server-ktor/src/main/java/nl/myndocs/oauth2/ktor/feature/Oauth2ServerFeature.kt
@@ -1,29 +1,27 @@
package nl.myndocs.oauth2.ktor.feature
-import io.ktor.application.ApplicationCallPipeline
-import io.ktor.application.ApplicationFeature
-import io.ktor.application.call
import io.ktor.util.AttributeKey
import nl.myndocs.oauth2.config.Configuration
import nl.myndocs.oauth2.config.ConfigurationBuilder
import nl.myndocs.oauth2.ktor.feature.config.KtorConfiguration
import nl.myndocs.oauth2.ktor.feature.request.KtorCallContext
+import io.ktor.server.application.*
-class Oauth2ServerFeature(configuration: Configuration) {
+public class Oauth2ServerFeature(configuration: Configuration) {
val callRouter = configuration.callRouter
- companion object Feature : ApplicationFeature {
+ public companion object : BaseApplicationPlugin {
override val key = AttributeKey("Oauth2ServerFeature")
- override fun install(pipeline: ApplicationCallPipeline, configure: KtorConfiguration.() -> Unit): Oauth2ServerFeature {
+ override fun install(pipeline: Application, configure: KtorConfiguration.() -> Unit): Oauth2ServerFeature {
val ktorConfiguration = KtorConfiguration()
configure(ktorConfiguration)
- val configuration = ConfigurationBuilder.build(configure as ConfigurationBuilder.Configuration.() -> Unit, ktorConfiguration)
-
+ val configuration =
+ ConfigurationBuilder.build(configure as ConfigurationBuilder.Configuration.() -> Unit, ktorConfiguration)
val feature = Oauth2ServerFeature(configuration)
- pipeline.intercept(ApplicationCallPipeline.Features) {
+ pipeline.intercept(ApplicationCallPipeline.Plugins) {
val ktorCallContext = KtorCallContext(call)
if (configuration.callRouter.authorizeEndpoint == ktorCallContext.path) {
@@ -31,10 +29,10 @@ class Oauth2ServerFeature(configuration: Configuration) {
}
if (
- arrayOf(
- configuration.callRouter.tokenEndpoint,
- configuration.callRouter.tokenInfoEndpoint
- ).contains(ktorCallContext.path)
+ arrayOf(
+ configuration.callRouter.tokenEndpoint,
+ configuration.callRouter.tokenInfoEndpoint
+ ).contains(ktorCallContext.path)
) {
feature.callRouter.route(ktorCallContext)
}
diff --git a/oauth2-server-ktor/src/main/java/nl/myndocs/oauth2/ktor/feature/config/KtorConfiguration.kt b/oauth2-server-ktor/src/main/java/nl/myndocs/oauth2/ktor/feature/config/KtorConfiguration.kt
index 7914b15..33955d4 100644
--- a/oauth2-server-ktor/src/main/java/nl/myndocs/oauth2/ktor/feature/config/KtorConfiguration.kt
+++ b/oauth2-server-ktor/src/main/java/nl/myndocs/oauth2/ktor/feature/config/KtorConfiguration.kt
@@ -1,6 +1,6 @@
package nl.myndocs.oauth2.ktor.feature.config
-import io.ktor.application.*
+import io.ktor.server.application.*
import nl.myndocs.oauth2.config.ConfigurationBuilder
import nl.myndocs.oauth2.ktor.feature.request.KtorCallContext
import nl.myndocs.oauth2.request.auth.CallContextBasicAuthenticator
diff --git a/oauth2-server-ktor/src/main/java/nl/myndocs/oauth2/ktor/feature/request/KtorCallContext.kt b/oauth2-server-ktor/src/main/java/nl/myndocs/oauth2/ktor/feature/request/KtorCallContext.kt
index 6bfcf5e..c89ec1b 100644
--- a/oauth2-server-ktor/src/main/java/nl/myndocs/oauth2/ktor/feature/request/KtorCallContext.kt
+++ b/oauth2-server-ktor/src/main/java/nl/myndocs/oauth2/ktor/feature/request/KtorCallContext.kt
@@ -1,14 +1,9 @@
package nl.myndocs.oauth2.ktor.feature.request
-import io.ktor.application.ApplicationCall
-import io.ktor.http.HttpStatusCode
-import io.ktor.request.header
-import io.ktor.request.httpMethod
-import io.ktor.request.path
-import io.ktor.request.receiveParameters
-import io.ktor.response.header
-import io.ktor.response.respondRedirect
-import io.ktor.response.respondText
+import io.ktor.http.*
+import io.ktor.server.application.*
+import io.ktor.server.request.*
+import io.ktor.server.response.*
import io.ktor.util.toMap
import kotlinx.coroutines.runBlocking
import nl.myndocs.oauth2.authenticator.Credentials
@@ -19,17 +14,17 @@ class KtorCallContext(val applicationCall: ApplicationCall) : CallContext {
override val path: String = applicationCall.request.path()
override val method: String = applicationCall.request.httpMethod.value
override val headers: Map = applicationCall.request
- .headers
- .toMap()
- .mapValues { applicationCall.request.header(it.key) }
- .filterValues { it != null }
- .mapValues { it.value!! }
+ .headers
+ .toMap()
+ .mapValues { applicationCall.request.header(it.key) }
+ .filterValues { it != null }
+ .mapValues { it.value!! }
override val queryParameters: Map = applicationCall.request
- .queryParameters
- .toMap()
- .filterValues { it.isNotEmpty() }
- .mapValues { it.value.first() }
+ .queryParameters
+ .toMap()
+ .filterValues { it.isNotEmpty() }
+ .mapValues { it.value.first() }
private var _formParameters: Map? = null
override val formParameters: Map
@@ -39,9 +34,9 @@ class KtorCallContext(val applicationCall: ApplicationCall) : CallContext {
if (_formParameters == null) {
_formParameters = runBlocking {
applicationCall.receiveParameters()
- .toMap()
- .filterValues { it.isNotEmpty() }
- .mapValues { it.value.first() }
+ .toMap()
+ .filterValues { it.isNotEmpty() }
+ .mapValues { it.value.first() }
}
}
@@ -59,8 +54,8 @@ class KtorCallContext(val applicationCall: ApplicationCall) : CallContext {
override fun respondJson(content: Any) {
runBlocking {
applicationCall.respondText(
- JsonMapper.toJson(content),
- io.ktor.http.ContentType.Application.Json
+ JsonMapper.toJson(content),
+ io.ktor.http.ContentType.Application.Json
)
}
}
diff --git a/oauth2-server-ktor/src/test/java/nl/myndocs/oauth2/ktor/integration/KtorIntegrationTest.kt b/oauth2-server-ktor/src/test/java/nl/myndocs/oauth2/ktor/integration/KtorIntegrationTest.kt
index 834d9b2..d3ced8d 100644
--- a/oauth2-server-ktor/src/test/java/nl/myndocs/oauth2/ktor/integration/KtorIntegrationTest.kt
+++ b/oauth2-server-ktor/src/test/java/nl/myndocs/oauth2/ktor/integration/KtorIntegrationTest.kt
@@ -1,6 +1,6 @@
package nl.myndocs.oauth2.ktor.integration
-import io.ktor.application.install
+import io.ktor.server.application.install
import io.ktor.server.engine.embeddedServer
import io.ktor.server.netty.Netty
import io.ktor.server.netty.NettyApplicationEngine
@@ -37,7 +37,7 @@ class KtorIntegrationTest : BaseIntegrationTest() {
@AfterEach
fun after() {
- server!!.stop(0, 10, TimeUnit.SECONDS)
+ server!!.stop(0, 10000)
}
}
\ No newline at end of file
diff --git a/oauth2-server-sparkjava/pom.xml b/oauth2-server-sparkjava/pom.xml
index 2af8fd8..02aa86c 100644
--- a/oauth2-server-sparkjava/pom.xml
+++ b/oauth2-server-sparkjava/pom.xml
@@ -5,7 +5,7 @@
kotlin-oauth2-server
nl.myndocs
- 0.7.1
+ 0.7.2-SNAPSHOT
4.0.0
@@ -15,7 +15,7 @@
com.sparkjava
spark-core
- 2.8.0
+ 2.9.3
provided
diff --git a/oauth2-server-token-store-inmemory/pom.xml b/oauth2-server-token-store-inmemory/pom.xml
index 7b04907..1e87b84 100644
--- a/oauth2-server-token-store-inmemory/pom.xml
+++ b/oauth2-server-token-store-inmemory/pom.xml
@@ -5,7 +5,7 @@
kotlin-oauth2-server
nl.myndocs
- 0.7.1
+ 0.7.2-SNAPSHOT
4.0.0
diff --git a/pom.xml b/pom.xml
index a025e5f..1370a83 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
nl.myndocs
kotlin-oauth2-server
pom
- 0.7.1
+ 0.7.2-SNAPSHOT
Kotlin OAuth2 server
Flexible OAuth2 implementation
https://github.com/myndocs/kotlin-oauth2-server
@@ -31,7 +31,7 @@
- 1.3.31
+ 1.6.21
1.8
1.8
1.6.21
@@ -69,25 +69,25 @@
org.junit.jupiter
junit-jupiter-engine
- 5.2.0
+ 5.8.2
test
io.mockk
mockk
- 1.9.3
+ 1.12.3
test
org.hamcrest
hamcrest-library
- 1.3
+ 2.2
test
org.slf4j
slf4j-simple
- 1.7.25
+ 1.7.36
test