commit 460040f525c46cca3f03aa254660eadc11d404e6
parent 9cf2e87353147cd8775226fb6fd4e10ddb91222a
Author: Antoine A <>
Date: Mon, 25 Nov 2024 18:55:31 +0100
bank: remove auth from all /config endpoints
Diffstat:
4 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/api/RevenueApi.kt b/bank/src/main/kotlin/tech/libeufin/bank/api/RevenueApi.kt
@@ -32,12 +32,12 @@ import tech.libeufin.common.RevenueConfig
import tech.libeufin.common.RevenueIncomingHistory
fun Routing.revenueApi(db: Database, cfg: BankConfig) {
+ get("/accounts/{USERNAME}/taler-revenue/config") {
+ call.respond(RevenueConfig(
+ currency = cfg.regionalCurrency
+ ))
+ }
auth(db, cfg.pwCrypto, TokenLogicalScope.revenue, cfg.basicAuthCompat) {
- get("/accounts/{USERNAME}/taler-revenue/config") {
- call.respond(RevenueConfig(
- currency = cfg.regionalCurrency
- ))
- }
get("/accounts/{USERNAME}/taler-revenue/history") {
val params = HistoryParams.extract(call.request.queryParameters)
val bankAccount = call.bankInfo(db, cfg.payto)
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/api/WireGatewayApi.kt b/bank/src/main/kotlin/tech/libeufin/bank/api/WireGatewayApi.kt
@@ -40,12 +40,12 @@ import java.time.Instant
fun Routing.wireGatewayApi(db: Database, cfg: BankConfig) {
+ get("/accounts/{USERNAME}/taler-wire-gateway/config") {
+ call.respond(WireGatewayConfig(
+ currency = cfg.regionalCurrency
+ ))
+ }
auth(db, cfg.pwCrypto, TokenLogicalScope.readwrite_wiregateway, cfg.basicAuthCompat) {
- get("/accounts/{USERNAME}/taler-wire-gateway/config") {
- call.respond(WireGatewayConfig(
- currency = cfg.regionalCurrency
- ))
- }
post("/accounts/{USERNAME}/taler-wire-gateway/transfer") {
val req = call.receive<TransferRequest>()
cfg.checkRegionalCurrency(req.amount)
diff --git a/bank/src/test/kotlin/RevenueApiTest.kt b/bank/src/test/kotlin/RevenueApiTest.kt
@@ -18,6 +18,7 @@
*/
import io.ktor.http.*
+import io.ktor.client.request.*
import org.junit.Test
import tech.libeufin.common.RevenueIncomingHistory
import tech.libeufin.common.assertOk
@@ -27,9 +28,7 @@ class RevenueApiTest {
// GET /accounts/{USERNAME}/taler-revenue/config
@Test
fun config() = bankSetup {
- authRoutine(HttpMethod.Get, "/accounts/merchant/taler-revenue/config")
-
- client.getA("/accounts/merchant/taler-revenue/config").assertOk()
+ client.get("/accounts/merchant/taler-revenue/config").assertOk()
}
// GET /accounts/{USERNAME}/taler-revenue/history
diff --git a/bank/src/test/kotlin/WireGatewayApiTest.kt b/bank/src/test/kotlin/WireGatewayApiTest.kt
@@ -19,6 +19,7 @@
import io.ktor.http.*
import io.ktor.server.testing.*
+import io.ktor.client.request.*
import org.junit.Test
import tech.libeufin.common.*
import tech.libeufin.common.test.*
@@ -28,9 +29,7 @@ class WireGatewayApiTest {
// GET /accounts/{USERNAME}/taler-wire-gateway/config
@Test
fun config() = bankSetup {
- authRoutine(HttpMethod.Get, "/accounts/merchant/taler-wire-gateway/config")
-
- client.getA("/accounts/merchant/taler-wire-gateway/config").assertOk()
+ client.get("/accounts/merchant/taler-wire-gateway/config").assertOk()
}
// POST /accounts/{USERNAME}/taler-wire-gateway/transfer