From eeae76fd92e2ba4e9addedd03f809bcb0f6b618d Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Wed, 8 Feb 2017 14:16:40 +0000 Subject: [PATCH] Split users for bank and big corp --- .../main/kotlin/net/corda/bank/BankOfCordaDriver.kt | 10 +++++++--- .../kotlin/net/corda/bank/api/BankOfCordaClientApi.kt | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/BankOfCordaDriver.kt b/samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/BankOfCordaDriver.kt index cc98f123a0..1bfd3b874c 100644 --- a/samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/BankOfCordaDriver.kt +++ b/samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/BankOfCordaDriver.kt @@ -22,6 +22,9 @@ fun main(args: Array) { BankOfCordaDriver().main(args) } +val BANK_USERNAME = "bankUser" +val BIGCORP_USERNAME = "bigCorpUser" + private class BankOfCordaDriver { enum class Role { ISSUE_CASH_RPC, @@ -48,10 +51,11 @@ private class BankOfCordaDriver { val role = options.valueOf(roleArg)!! if (role == Role.ISSUER) { driver(dsl = { - val user = User("user1", "test", permissions = setOf(startFlowPermission(), startFlowPermission())) + val bankUser = User(BANK_USERNAME, "test", permissions = setOf(startFlowPermission(), startFlowPermission())) + val bigCorpUser = User(BIGCORP_USERNAME, "test", permissions = setOf(startFlowPermission())) startNode("Notary", setOf(ServiceInfo(SimpleNotaryService.type))) - val bankOfCorda = startNode("BankOfCorda", rpcUsers = listOf(user), advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("issuer.USD")))) - startNode("BigCorporation", rpcUsers = listOf(user)) + val bankOfCorda = startNode("BankOfCorda", rpcUsers = listOf(bankUser), advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("issuer.USD")))) + startNode("BigCorporation", rpcUsers = listOf(bigCorpUser)) startWebserver(bankOfCorda.get()) waitForAllNodesToFinish() }, isDebug = true) diff --git a/samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/api/BankOfCordaClientApi.kt b/samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/api/BankOfCordaClientApi.kt index 4069f988de..3baac0202f 100644 --- a/samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/api/BankOfCordaClientApi.kt +++ b/samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/api/BankOfCordaClientApi.kt @@ -32,7 +32,7 @@ class BankOfCordaClientApi(val hostAndPort: HostAndPort) { fun requestRPCIssue(params: IssueRequestParams): SignedTransaction { val client = CordaRPCClient(hostAndPort, configureTestSSL()) // TODO: privileged security controls required - client.start("user1","test") + client.start("user1", "test") val proxy = client.proxy() // Resolve parties via RPC