Lucas León
02/22/2022, 3:17 AM<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="<http://maven.apache.org/POM/4.0.0>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>"
xsi:schemaLocation="<http://maven.apache.org/POM/4.0.0> <https://maven.apache.org/xsd/maven-4.0.0.xsd>">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demoproject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demoproject</name>
<description>demoproject</description>
<properties>
<java.version>1.8</java.version>
<kotlin.version>1.6.10</kotlin.version>
<ktor.version>1.6.7</ktor.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor.kotlin</groupId>
<artifactId>reactor-kotlin-extensions</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-reactor</artifactId>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-client-core</artifactId>
<version>${ktor.version}</version>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-client-cio</artifactId>
<version>${ktor.version}</version>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-client-serialization</artifactId>
<version>${ktor.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<configuration>
<args>
<arg>-Xjsr305=strict</arg>
</args>
<compilerPlugins>
<plugin>spring</plugin>
</compilerPlugins>
</configuration>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
An this is what I get :André Martins
02/22/2022, 10:51 AMRichie Bresnan
02/22/2022, 5:29 PMLogLevel.HEADERS
) application/customer secrets in the auth header are logged as below. I’d like to redact these secrets, as ******
. Has anyone found a non-invasive way of doing this?
[***] 2022-02-22 08:59:45.641 [main] INFO io.ktor.client.HttpClient - METHOD: HttpMethod(value=GET)
[***] 2022-02-22 08:59:45.641 [main] INFO io.ktor.client.HttpClient - COMMON HEADERS
[***] 2022-02-22 08:59:45.641 [main] INFO io.ktor.client.HttpClient - -> Accept: application/json
[***] 2022-02-22 08:59:45.641 [main] INFO io.ktor.client.HttpClient - -> Accept-Charset: UTF-8
[***] 2022-02-22 08:59:45.641 [main] INFO io.ktor.client.HttpClient - -> Authorization: token my_super_secret_token_that_I_want_to_redact
dany giguere
02/22/2022, 9:07 PM"errors": {
"title": ["The title must contain at least 20 characters"],
"body": ["The body must contain at least 20 characters"]
}
J Man
02/22/2022, 11:40 PMJ Man
02/23/2022, 12:47 AMhhariri
André Martins
02/23/2022, 12:17 PMJavier
02/23/2022, 2:44 PMexpectedType
in request or send pipelines?Werner Guttmann
02/23/2022, 3:08 PMBartłomiej Gaweł
02/23/2022, 5:44 PMdany giguere
02/23/2022, 9:45 PMcall
available from it ? :
fun Application.hasSignedUrlMiddleware() {
routing {
val uri = call.request.uri
// if(url doesn't have a signed url) {
// throw AuthorizationException("Sorry you are not authorized")
// }
}
}
get("/posts") {
hasSignedUrlMiddleware()
call.respond(mapOf("posts" to postDAO.all()))
}
Kiet
02/24/2022, 3:34 AMishitatsuyuki
02/24/2022, 10:42 AMishitatsuyuki
02/24/2022, 12:40 PMishitatsuyuki
02/24/2022, 2:05 PMCould not find org.jetbrains.kotlin:kotlin-stdlib-common:1.6.20-M1-106.
and things like this for a full screen spam.jean
02/24/2022, 3:13 PMfun main() {
embeddedServer(
factory = CIO,
environment = applicationEngineEnvironment {
config = HoconApplicationConfig(ConfigFactory.load())
connector {
port = 8080
}
module(Application::module)
},
).start(wait = true)
}
fun Application.module() {
val jwtValues = jwtValues(environment)
val pbkdf2Values = pbkdf2Values(environment)
val database = SamkjoringDatabase()
configureRouting(jwtValues, pbkdf2Values, database)
configureSerialization()
configureSecurity()
configureTemplate()
}
and my resources/application.conf
jwt {
secret = "7lgeBk06UhkLRLFDhQn3"
issuer = "<http://0.0.0.0:8080/>"
audience = "<http://0.0.0.0:8080/login>"
realm = "Access to 'login'"
}
pbkdf2 {
salt = "qdQk4P2TNvHc"
iterations = "10000"
keyLength = "512"
}
But I get the error
Exception in thread “main” io.ktor.config.ApplicationConfigurationException: Property jwt.secret not found.
at io.ktor.config.HoconApplicationConfig.property(HoconApplicationConfig.kt:15)
at no.samkjoring.plugins.auth.JwtKt.jwtValues(jwt.kt:27)What am I missing here?
Nikky
02/25/2022, 2:29 AMcall.respondText(text = cause.message, status = HttpStatusCode.InternalServerError)
seems to not trigger a http response and the request is just hangingJason Han
02/25/2022, 7:16 AMrouting {
someRoute1()
someRoute2()
...
someRoute100()
}
with each group of routes in it's own file
fun Application.someRoute1() {
routing {
route('/some/{place}') {
head {
}
get {
}
}
}
}
however, we now want to add authentication to all routes, but if we add the authenticate function to the first example,
routing {
authenticate {
someRoute1()
someRoute2()
...
someRoute100()
}
}
it doesn't seem like the individual route functions get the authenticate function. Is there a way to do this without manually editing each individual route file?ishitatsuyuki
02/25/2022, 8:27 AMembeddedServer
? There are two serious issues:
1. The documentation doesn't mention that the reloader only works if the module
parammeter to embeddedServer
refers to a function (if you use the lambda in attempt for simplicity, it doesn't work).
2. The server appears to break and start giving empty responses under some race condition, maybe if another HTTP request arrive during the restart? (still debugging)Nikky
02/25/2022, 3:25 PMhttps://nikky.catgirl.host/i/x00fif8f.png▾
embeddedServer
call chain and add a custom KtorSimpleLogger
implementationrobnik
02/25/2022, 10:18 PMstatic("/static") { resources() }
, which serves the compiled JS. Problem is: it serves all resources! Insecure, no? How do I change the gradle file to copy the compiled JS into a subdir? (More in thread)Kedar
02/27/2022, 1:43 AMJoakim Forslund
02/27/2022, 10:43 AMNikky
02/27/2022, 12:22 PMserver.start(wait = true)
will just block my application completely when i call server.stop(500, 500)
not sure why.. could it be that joining the jobs is blocking ?
for now i am using this..
server = embeddedServer(...)
server.start(wait = false)
while (true) {
sleep(1)
}
and in the signal handler i call
server.stop(500, 500)
if anybody knows a cleaner solution.. would like to make this work better
i also noticed.. if i use delay
instead of sleep it will also continue to block..?dleuck
02/28/2022, 4:10 AMAmin Bahiraei
02/28/2022, 12:29 PMdefaultRequest
but it crashesh in iOS, and when I wanna set contentType
in post request,
this exception raise
I have also installed `ContentNegotation` and `json`
Fail to serialize body. Content has type: class org.metatude.paxfa.auth.login.LoginEmailRequestDto, but OutgoingContent expected.
If you expect serialized body, please check that you have installed the corresponding plugin(like `ContentNegotiation`) and set `Content-Type` header.
Bridgette Powell
02/28/2022, 8:41 PMBarry Fawthrop
03/01/2022, 1:28 AMAnkit Dubey
03/01/2022, 6:00 AM