mirror of
https://github.com/corda/corda.git
synced 2025-06-13 12:48:18 +00:00
Legal name validation for X500Name (#983)
* * Legal name validation for X500Name while loading from config file. * * Removed unintended changes.
This commit is contained in:
@ -3,6 +3,7 @@ package net.corda.nodeapi.config
|
||||
import com.typesafe.config.Config
|
||||
import com.typesafe.config.ConfigUtil
|
||||
import net.corda.core.noneOrSingle
|
||||
import net.corda.core.utilities.validateX500Name
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.parseNetworkHostAndPort
|
||||
import org.bouncycastle.asn1.x500.X500Name
|
||||
@ -72,7 +73,7 @@ private fun Config.getSingleValue(path: String, type: KType): Any? {
|
||||
Path::class -> Paths.get(getString(path))
|
||||
URL::class -> URL(getString(path))
|
||||
Properties::class -> getConfig(path).toProperties()
|
||||
X500Name::class -> X500Name(getString(path))
|
||||
X500Name::class -> X500Name(getString(path)).apply(::validateX500Name)
|
||||
else -> if (typeClass.java.isEnum) {
|
||||
parseEnum(typeClass.java, getString(path))
|
||||
} else {
|
||||
|
@ -112,7 +112,7 @@ class ConfigParsingTest {
|
||||
|
||||
@Test
|
||||
fun x500Name() {
|
||||
testPropertyType<X500NameData, X500NameListData, X500Name>(getTestX509Name("Mock Node"), getTestX509Name("Mock Node 2"), valuesToString = true)
|
||||
testPropertyType<X500NameData, X500NameListData, X500Name>(getTestX509Name("Mock Party"), getTestX509Name("Mock Party 2"), valuesToString = true)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user