mirror of
https://github.com/corda/corda.git
synced 2025-06-02 07:30:53 +00:00
Ban common name. (#1568)
This commit is contained in:
parent
0314e650a4
commit
d1e5fbb73d
@ -155,7 +155,7 @@ abstract class AbstractNode(open val configuration: NodeConfiguration,
|
|||||||
* or has loaded network map data from local database */
|
* or has loaded network map data from local database */
|
||||||
val nodeReadyFuture: CordaFuture<Unit>
|
val nodeReadyFuture: CordaFuture<Unit>
|
||||||
get() = _nodeReadyFuture
|
get() = _nodeReadyFuture
|
||||||
|
/** A [CordaX500Name] with null common name. */
|
||||||
protected val myLegalName: CordaX500Name by lazy {
|
protected val myLegalName: CordaX500Name by lazy {
|
||||||
val cert = loadKeyStore(configuration.nodeKeystore, configuration.keyStorePassword).getX509Certificate(X509Utilities.CORDA_CLIENT_CA)
|
val cert = loadKeyStore(configuration.nodeKeystore, configuration.keyStorePassword).getX509Certificate(X509Utilities.CORDA_CLIENT_CA)
|
||||||
CordaX500Name.build(cert.subjectX500Principal).copy(commonName = null)
|
CordaX500Name.build(cert.subjectX500Principal).copy(commonName = null)
|
||||||
@ -643,7 +643,7 @@ abstract class AbstractNode(open val configuration: NodeConfiguration,
|
|||||||
|
|
||||||
val (id, name) = if (serviceInfo == null) {
|
val (id, name) = if (serviceInfo == null) {
|
||||||
// Create node identity if service info = null
|
// Create node identity if service info = null
|
||||||
Pair("identity", myLegalName.copy(commonName = null))
|
Pair("identity", myLegalName)
|
||||||
} else {
|
} else {
|
||||||
val name = serviceInfo.name ?: myLegalName.copy(commonName = serviceInfo.type.id)
|
val name = serviceInfo.name ?: myLegalName.copy(commonName = serviceInfo.type.id)
|
||||||
Pair(serviceInfo.type.id, name)
|
Pair(serviceInfo.type.id, name)
|
||||||
|
@ -79,6 +79,7 @@ data class FullNodeConfiguration(
|
|||||||
rpcUsers.forEach {
|
rpcUsers.forEach {
|
||||||
require(it.username.matches("\\w+".toRegex())) { "Username ${it.username} contains invalid characters" }
|
require(it.username.matches("\\w+".toRegex())) { "Username ${it.username} contains invalid characters" }
|
||||||
}
|
}
|
||||||
|
require(myLegalName.commonName == null) { "Common name must be null: $myLegalName" }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun calculateServices(): Set<ServiceInfo> {
|
fun calculateServices(): Set<ServiceInfo> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user