feat: Hostの署名に対応

This commit is contained in:
usbharu 2023-04-29 15:44:48 +09:00
parent d2971d02a5
commit 068cbbc076
1 changed files with 5 additions and 2 deletions

View File

@ -47,7 +47,7 @@ suspend fun HttpClient.postAp(urlString: String, username: String, jsonLd: JsonL
suspend fun HttpClient.getAp(urlString: String,username: String):HttpResponse {
return this.get(urlString){
header("Accept",ContentType.Application.Activity)
header("Signature","keyId=\"$username\",algorithm=\"rsa-sha256\",headers=\"(request-target) date\"")
header("Signature","keyId=\"$username\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date\"")
}
}
@ -63,6 +63,7 @@ val httpSignaturePlugin = createClientPlugin("HttpSign", ::HttpSignaturePluginCo
request.header("Date", format.format(Date()))
request.header("Host",request.url.host+request.url.port.toString())
println(request.bodyType)
println(request.bodyType?.type)
if (request.bodyType?.type == String::class) {
@ -110,7 +111,9 @@ val httpSignaturePlugin = createClientPlugin("HttpSign", ::HttpSignaturePluginCo
"date" -> {
"Date"
}
"host" -> {
"Host"
}
else -> {
it
}