Skip to content
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

Upgrade packages #194

Closed
wants to merge 2 commits into from
Closed
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
66 changes: 34 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask

buildscript {
ext.kotlin_version = '1.8.10'
ext.ktor_version = '2.2.4'
ext.kotlin_version = '1.9.23'
ext.ktor_version = '2.3.9'
ext.koin_version = '3.4.3'
ext.shadow_version = '8.1.1'
ext.exposed_version = "0.37.3"
ext.jooq_version = '3.16.15'
ext.hikari_cp_version = "5.0.1"
ext.junit_version = '5.9.2'
ext.flyway_version = '9.16.0'
ext.casbin_version = '1.32.2'
ext.postgres_jdbc_driver = '42.5.4'
ext.detekt_version = '1.19.0'
ext.cohort_version = '1.7.3'
ext.jooq_version = '3.16.23'
ext.hikari_cp_version = "5.1.0"
ext.junit_version = '5.10.0'
ext.flyway_version = '9.22.3'
ext.casbin_version = '1.55.0'
ext.postgres_jdbc_driver = '42.7.3'
ext.detekt_version = '1.23.6'
ext.cohort_version = '2.3.1'
ext.ktlint_version = '1.2.1'

repositories {
google()
Expand All @@ -37,9 +38,9 @@ plugins {
id 'org.flywaydb.flyway' version "$flyway_version"
id 'nu.studer.jooq' version '7.1'
id "io.gitlab.arturbosch.detekt" version "$detekt_version"
id "org.jlleitschuh.gradle.ktlint" version "12.0.3"
id "org.jlleitschuh.gradle.ktlint" version "12.1.0"
id "jacoco"
id "org.openapi.generator" version "5.3.0"
id "org.openapi.generator" version "7.4.0"
id "com.osacky.doctor" version "0.8.0"
}

Expand Down Expand Up @@ -80,9 +81,11 @@ compileTestKotlin {
test {
jvmArgs("--add-opens", "java.base/java.time=ALL-UNNAMED")
useJUnitPlatform()
maxParallelForks = 2
testLogging.showStandardStreams(true)
finalizedBy jacocoTestReport // report is always generated after tests run
}

jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
Expand Down Expand Up @@ -311,6 +314,7 @@ detekt {
//}

ktlint {
version.set("1.2.1")
verbose.set(true)
outputToConsole.set(true)
coloredOutput.set(true)
Expand All @@ -323,14 +327,13 @@ ktlint {
}

dependencies {
// detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detekt_version")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
implementation("io.ktor:ktor-server-cio:$ktor_version")
implementation("io.ktor:ktor-server-metrics:$ktor_version")
implementation("io.ktor:ktor-server-locations:$ktor_version")
// implementation("io.ktor:ktor-gson:$ktor_version")
implementation("io.ktor:ktor-client-core:$ktor_version")

implementation("io.ktor:ktor-client-apache:$ktor_version")

// Ktor features
implementation("io.ktor:ktor-server-content-negotiation:$ktor_version")
implementation("io.ktor:ktor-serialization-gson:$ktor_version")
Expand All @@ -349,9 +352,8 @@ dependencies {

implementation("io.ktor:ktor-server-auth:$ktor_version")


implementation('ch.qos.logback:logback-classic:1.4.7')
implementation('org.codehaus.janino:janino:3.1.8')
implementation('ch.qos.logback:logback-classic:1.5.3')
implementation('org.codehaus.janino:janino:3.1.12')
implementation("com.zaxxer:HikariCP:$hikari_cp_version") // DB connection pooling
implementation("org.flywaydb:flyway-core:$flyway_version") // DB Migrations
implementation("org.postgresql:postgresql:$postgres_jdbc_driver") // DB JDBC driver
Expand All @@ -371,8 +373,8 @@ dependencies {
implementation "io.insert-koin:koin-logger-slf4j:$koin_version"

// Logging
implementation 'io.github.microutils:kotlin-logging:2.1.21'
implementation 'org.slf4j:slf4j-simple:1.7.36'
implementation 'io.github.microutils:kotlin-logging:3.0.5'
implementation 'org.slf4j:slf4j-simple:2.0.12'

// Metrics
implementation "io.ktor:ktor-server-metrics-micrometer:$ktor_version"
Expand All @@ -391,20 +393,20 @@ dependencies {
implementation('io.konform:konform:0.4.0')

// AWS Lambda
implementation('com.amazonaws:aws-lambda-java-core:1.2.2')
implementation("com.amazonaws:aws-lambda-java-events:3.11.0")
implementation('com.amazonaws:aws-lambda-java-core:1.2.3')
implementation("com.amazonaws:aws-lambda-java-events:3.11.4")

// Hoplite
implementation('com.sksamuel.hoplite:hoplite-json:2.7.2')
implementation('com.sksamuel.hoplite:hoplite-json:2.7.5')

// Cohort
implementation("com.sksamuel.cohort:cohort-core:$cohort_version")
implementation("com.sksamuel.cohort:cohort-ktor2:$cohort_version")
// implementation("com.sksamuel.cohort:cohort-ktor:1.7.3")
implementation("com.sksamuel.cohort:cohort-hikari:$cohort_version")
implementation("com.sksamuel.cohort:cohort-logback:$cohort_version")

// AWS
implementation platform('software.amazon.awssdk:bom:2.18.25')
implementation platform('software.amazon.awssdk:bom:2.25.20')
implementation("software.amazon.awssdk:cognitoidentity")
implementation("software.amazon.awssdk:cognitoidentityprovider")
implementation("software.amazon.awssdk:ses")
Expand All @@ -413,23 +415,23 @@ dependencies {
implementation("com.github.hwslabs:txman:0.1.6")

//Mustache Template
implementation("net.pwall.mustache:kotlin-mustache:0.10")
implementation("net.pwall.mustache:kotlin-mustache:0.12")

// OkHttp Client
implementation("com.squareup.okhttp3:okhttp:4.10.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.10.0")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")

// Test dependencies
testImplementation("io.ktor:ktor-server-test-host:$ktor_version")
testImplementation("io.insert-koin:koin-test:$koin_version")
testImplementation "io.insert-koin:koin-test-junit5:$koin_version"
testImplementation("org.junit.jupiter:junit-jupiter-api:$junit_version")
testImplementation('io.mockk:mockk:1.13.4')
testImplementation('io.mockk:mockk:1.13.10')
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junit_version")

testImplementation 'org.testcontainers:junit-jupiter:1.17.6'
testImplementation 'org.testcontainers:testcontainers:1.17.6'
testImplementation 'org.testcontainers:postgresql:1.17.6'
testImplementation 'org.testcontainers:junit-jupiter:1.19.7'
testImplementation 'org.testcontainers:testcontainers:1.19.7'
testImplementation 'org.testcontainers:postgresql:1.19.7'
}

// configure jOOQ task such that it only executes when something has changed that potentially affects the generated JOOQ sources
Expand Down
6 changes: 2 additions & 4 deletions detekt_config.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
formatting:
ImportOrdering:
layout: '*'

style:
ForbiddenComment:
allowedPatterns: 'TODO:'
MaxLineLength:
maxLineLength: 200
UseCheckOrError:
active: false

complexity:
LongMethod:
Expand Down
1 change: 1 addition & 0 deletions iam_openapi_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ paths:
parameters:
- $ref: '#/components/parameters/user_name'
- $ref: '#/components/parameters/organization_id'
- $ref: '#/components/parameters/sub_organization_name'
responses:
'200':
$ref: '#/components/responses/BaseSuccessResponse'
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/hypto/iam/server/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import com.hypto.iam.server.di.repositoryModule
import com.hypto.iam.server.security.Authorization
import com.hypto.iam.server.service.DatabaseFactory.pool
import com.hypto.iam.server.utils.ApplicationIdUtil
import com.sksamuel.cohort.Cohort
import com.sksamuel.cohort.HealthCheckRegistry
import com.sksamuel.cohort.db.DatabaseConnectionHealthCheck
import com.sksamuel.cohort.hikari.HikariDataSourceManager
import com.sksamuel.cohort.hikari.HikariPendingThreadsHealthCheck
import com.sksamuel.cohort.ktor.Cohort
import com.sksamuel.cohort.logback.LogbackManager
import com.sksamuel.cohort.threads.ThreadDeadlockHealthCheck
import io.ktor.serialization.gson.gson
Expand Down
4 changes: 0 additions & 4 deletions src/main/kotlin/com/hypto/iam/server/extensions/Mappers.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.hypto.iam.server.extensions

import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.hypto.iam.server.db.tables.pojos.Actions
import com.hypto.iam.server.db.tables.pojos.AuditEntries
import com.hypto.iam.server.db.tables.pojos.Credentials
Expand Down Expand Up @@ -40,8 +38,6 @@ import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

val hrnFactory = getKoinInstance<HrnFactory>()
val scopeListTypeToken = object : TypeToken<List<String>>() {}.type
private val gson: Gson = getKoinInstance()

fun Credential.Companion.from(record: CredentialsRecord): Credential {
return Credential(
Expand Down
11 changes: 1 addition & 10 deletions src/main/kotlin/com/hypto/iam/server/idp/CognitoProviderImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class CognitoIdentityProviderImpl : IdentityProvider, KoinComponent {
try {
return when (userCredentials) {
is PasswordCredentials -> createUserWithPassword(context, identityGroup, userCredentials)
is AccessTokenCredentials -> createUserWithAccessToken(context, identityGroup, userCredentials)
is AccessTokenCredentials -> TODO("Not implemented")
else -> throw UnsupportedCredentialsException("Credential type not supported")
}
} catch (e: UsernameExistsException) {
Expand All @@ -173,15 +173,6 @@ class CognitoIdentityProviderImpl : IdentityProvider, KoinComponent {
}
}

private fun createUserWithAccessToken(
context: RequestContext,
identityGroup: IdentityGroup,
userCredentials: AccessTokenCredentials,
): User {
logger.info("Creating cognito user with access token")
TODO("Not implemented")
}

override suspend fun getUser(
identityGroup: IdentityGroup,
userName: String,
Expand Down
13 changes: 6 additions & 7 deletions src/test/kotlin/com/hypto/iam/server/apis/ActionApiTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import io.ktor.http.ContentType
import io.ktor.http.HttpHeaders
import io.ktor.http.HttpStatusCode
import io.ktor.http.contentType
import io.ktor.http.withCharset
import io.ktor.server.config.ApplicationConfig
import io.ktor.server.testing.testApplication
import org.junit.jupiter.api.Assertions.assertEquals
Expand Down Expand Up @@ -53,7 +52,7 @@ class ActionApiTest : AbstractContainerBaseTest() {
val responseBody = gson.fromJson(response.bodyAsText(), Action::class.java)
assertEquals(HttpStatusCode.Created, response.status)
assertEquals(
ContentType.Application.Json.withCharset(Charsets.UTF_8),
ContentType.Application.Json,
response.contentType(),
)
assertEquals(
Expand Down Expand Up @@ -88,7 +87,7 @@ class ActionApiTest : AbstractContainerBaseTest() {
}
assertEquals(HttpStatusCode.OK, response.status)
assertEquals(
ContentType.Application.Json.withCharset(Charsets.UTF_8),
ContentType.Application.Json,
response.contentType(),
)

Expand Down Expand Up @@ -125,7 +124,7 @@ class ActionApiTest : AbstractContainerBaseTest() {
}
assertEquals(HttpStatusCode.Forbidden, response.status)
assertEquals(
ContentType.Application.Json.withCharset(Charsets.UTF_8),
ContentType.Application.Json,
response.contentType(),
)

Expand All @@ -152,7 +151,7 @@ class ActionApiTest : AbstractContainerBaseTest() {
header(HttpHeaders.Authorization, "Bearer $rootUserToken")
}
assertEquals(HttpStatusCode.OK, response.status)
assertEquals(ContentType.Application.Json.withCharset(Charsets.UTF_8), response.contentType())
assertEquals(ContentType.Application.Json, response.contentType())
val responseBody = gson.fromJson(response.bodyAsText(), BaseSuccessResponse::class.java)
assertEquals(true, responseBody.success)

Expand Down Expand Up @@ -189,7 +188,7 @@ class ActionApiTest : AbstractContainerBaseTest() {
}
assertEquals(HttpStatusCode.OK, response.status)
assertEquals(
ContentType.Application.Json.withCharset(Charsets.UTF_8),
ContentType.Application.Json,
response.contentType(),
)

Expand Down Expand Up @@ -224,7 +223,7 @@ class ActionApiTest : AbstractContainerBaseTest() {
}
assertEquals(HttpStatusCode.OK, response.status)
assertEquals(
ContentType.Application.Json.withCharset(Charsets.UTF_8),
ContentType.Application.Json,
response.contentType(),
)

Expand Down
Loading