mirror of
https://github.com/corda/corda.git
synced 2025-06-01 23:20:54 +00:00
Using a List for the identity certs in InMemoryIdentityService and PersistentIdentityService (#3210)
This commit is contained in:
parent
57fce1dd16
commit
093be1b88c
@ -161,6 +161,7 @@ see changes to this list.
|
|||||||
* Sasmit Sahu
|
* Sasmit Sahu
|
||||||
* Scott James
|
* Scott James
|
||||||
* Shams Asari (R3)
|
* Shams Asari (R3)
|
||||||
|
* Siddhartha Sengupta (Tradewind Markets)
|
||||||
* Simon Taylor (Barclays)
|
* Simon Taylor (Barclays)
|
||||||
* Sofus Mortensen (Digital Asset Holdings)
|
* Sofus Mortensen (Digital Asset Holdings)
|
||||||
* stevenroose
|
* stevenroose
|
||||||
|
@ -826,7 +826,7 @@ abstract class AbstractNode(val configuration: NodeConfiguration,
|
|||||||
private fun makeIdentityService(identityCert: X509Certificate): PersistentIdentityService {
|
private fun makeIdentityService(identityCert: X509Certificate): PersistentIdentityService {
|
||||||
val trustRoot = configuration.loadTrustStore().getCertificate(X509Utilities.CORDA_ROOT_CA)
|
val trustRoot = configuration.loadTrustStore().getCertificate(X509Utilities.CORDA_ROOT_CA)
|
||||||
val nodeCa = configuration.loadNodeKeyStore().getCertificate(X509Utilities.CORDA_CLIENT_CA)
|
val nodeCa = configuration.loadNodeKeyStore().getCertificate(X509Utilities.CORDA_CLIENT_CA)
|
||||||
return PersistentIdentityService(trustRoot, identityCert, nodeCa)
|
return PersistentIdentityService(trustRoot, listOf(identityCert, nodeCa))
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract fun makeTransactionVerifierService(): TransactionVerifierService
|
protected abstract fun makeTransactionVerifierService(): TransactionVerifierService
|
||||||
|
@ -24,7 +24,7 @@ import javax.annotation.concurrent.ThreadSafe
|
|||||||
*/
|
*/
|
||||||
// TODO There is duplicated logic between this and PersistentIdentityService
|
// TODO There is duplicated logic between this and PersistentIdentityService
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
class InMemoryIdentityService(identities: Array<out PartyAndCertificate>,
|
class InMemoryIdentityService(identities: List<out PartyAndCertificate> = emptyList(),
|
||||||
override val trustRoot: X509Certificate) : SingletonSerializeAsToken(), IdentityService {
|
override val trustRoot: X509Certificate) : SingletonSerializeAsToken(), IdentityService {
|
||||||
companion object {
|
companion object {
|
||||||
private val log = contextLogger()
|
private val log = contextLogger()
|
||||||
|
@ -28,10 +28,17 @@ import javax.persistence.Entity
|
|||||||
import javax.persistence.Id
|
import javax.persistence.Id
|
||||||
import javax.persistence.Lob
|
import javax.persistence.Lob
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An identity service that stores parties and their identities to a key value tables in the database. The entries are
|
||||||
|
* cached for efficient lookup.
|
||||||
|
*
|
||||||
|
* @param trustRoot certificate from the zone operator for identity on the network.
|
||||||
|
* @param caCertificates list of additional certificates.
|
||||||
|
*/
|
||||||
// TODO There is duplicated logic between this and InMemoryIdentityService
|
// TODO There is duplicated logic between this and InMemoryIdentityService
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
class PersistentIdentityService(override val trustRoot: X509Certificate,
|
class PersistentIdentityService(override val trustRoot: X509Certificate,
|
||||||
vararg caCertificates: X509Certificate) : SingletonSerializeAsToken(), IdentityServiceInternal {
|
caCertificates: List<X509Certificate> = emptyList()) : SingletonSerializeAsToken(), IdentityServiceInternal {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val log = contextLogger()
|
private val log = contextLogger()
|
||||||
|
@ -32,7 +32,7 @@ class InMemoryIdentityServiceTests {
|
|||||||
val BOB get() = bob.party
|
val BOB get() = bob.party
|
||||||
val BOB_IDENTITY get() = bob.identity
|
val BOB_IDENTITY get() = bob.identity
|
||||||
val BOB_PUBKEY get() = bob.publicKey
|
val BOB_PUBKEY get() = bob.publicKey
|
||||||
fun createService(vararg identities: PartyAndCertificate) = InMemoryIdentityService(identities, DEV_ROOT_CA.certificate)
|
fun createService(vararg identities: PartyAndCertificate) = InMemoryIdentityService(identities.toList(), DEV_ROOT_CA.certificate)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
|
@ -45,7 +45,7 @@ import java.util.*
|
|||||||
/**
|
/**
|
||||||
* Returns a simple [InMemoryIdentityService] containing the supplied [identities].
|
* Returns a simple [InMemoryIdentityService] containing the supplied [identities].
|
||||||
*/
|
*/
|
||||||
fun makeTestIdentityService(vararg identities: PartyAndCertificate) = InMemoryIdentityService(identities, DEV_ROOT_CA.certificate)
|
fun makeTestIdentityService(vararg identities: PartyAndCertificate) = InMemoryIdentityService(identities.toList(), DEV_ROOT_CA.certificate)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of [ServiceHub] that is designed for in-memory unit tests of contract validation logic. It has
|
* An implementation of [ServiceHub] that is designed for in-memory unit tests of contract validation logic. It has
|
||||||
|
@ -36,7 +36,7 @@ class InteractiveShellTest {
|
|||||||
override fun call() = a
|
override fun call() = a
|
||||||
}
|
}
|
||||||
|
|
||||||
private val ids = InMemoryIdentityService(arrayOf(megaCorp.identity), DEV_ROOT_CA.certificate)
|
private val ids = InMemoryIdentityService(listOf(megaCorp.identity), DEV_ROOT_CA.certificate)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
private val om = JacksonSupport.createInMemoryMapper(ids, YAMLFactory())
|
private val om = JacksonSupport.createInMemoryMapper(ids, YAMLFactory())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user