mirror of
https://github.com/corda/corda.git
synced 2025-01-19 11:16:54 +00:00
Addressed PR issues
This commit is contained in:
parent
d76db6d047
commit
e2f93f64a9
@ -168,6 +168,7 @@ private fun DoormanParameters.startDoorman() {
|
|||||||
logger.warn("Doorman server is in 'Approve All' mode, this will approve all incoming certificate signing request.")
|
logger.warn("Doorman server is in 'Approve All' mode, this will approve all incoming certificate signing request.")
|
||||||
// Approve all pending request.
|
// Approve all pending request.
|
||||||
object : CertificationRequestStorage by DBCertificateRequestStorage(database) {
|
object : CertificationRequestStorage by DBCertificateRequestStorage(database) {
|
||||||
|
// The doorman is in approve all mode, returns all pending request id as approved request id.
|
||||||
override fun getApprovedRequestIds() = getPendingRequestIds()
|
override fun getApprovedRequestIds() = getPendingRequestIds()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -22,7 +22,9 @@ class JiraCertificateRequestStorage(val delegate: CertificationRequestStorage,
|
|||||||
Approved, Rejected
|
Approved, Rejected
|
||||||
}
|
}
|
||||||
|
|
||||||
private val logger = loggerFor<JiraCertificateRequestStorage>()
|
companion object{
|
||||||
|
private val logger = loggerFor<JiraCertificateRequestStorage>()
|
||||||
|
}
|
||||||
|
|
||||||
// The JIRA project must have a Request ID field and the Task issue type.
|
// The JIRA project must have a Request ID field and the Task issue type.
|
||||||
private val requestIdField: Field = jiraClient.metadataClient.fields.claim().find { it.name == "Request ID" }!!
|
private val requestIdField: Field = jiraClient.metadataClient.fields.claim().find { it.name == "Request ID" }!!
|
||||||
@ -34,9 +36,7 @@ class JiraCertificateRequestStorage(val delegate: CertificationRequestStorage,
|
|||||||
val response = getResponse(requestId)
|
val response = getResponse(requestId)
|
||||||
if (response !is CertificateResponse.Unauthorised) {
|
if (response !is CertificateResponse.Unauthorised) {
|
||||||
val request = StringWriter()
|
val request = StringWriter()
|
||||||
JcaPEMWriter(request).use {
|
JcaPEMWriter(request).writeObject(PemObject("CERTIFICATE REQUEST", certificationData.request.encoded))
|
||||||
it.writeObject(PemObject("CERTIFICATE REQUEST", certificationData.request.encoded))
|
|
||||||
}
|
|
||||||
val commonName = certificationData.request.subject.commonName
|
val commonName = certificationData.request.subject.commonName
|
||||||
val email = certificationData.request.subject.getRDNs(BCStyle.EmailAddress).firstOrNull()?.first?.value
|
val email = certificationData.request.subject.getRDNs(BCStyle.EmailAddress).firstOrNull()?.first?.value
|
||||||
val nearestCity = certificationData.request.subject.getRDNs(BCStyle.L).firstOrNull()?.first?.value
|
val nearestCity = certificationData.request.subject.getRDNs(BCStyle.L).firstOrNull()?.first?.value
|
||||||
@ -46,7 +46,7 @@ class JiraCertificateRequestStorage(val delegate: CertificationRequestStorage,
|
|||||||
.setDescription("Legal Name: $commonName\nNearest City: $nearestCity\nEmail: $email\n\n{code}$request{code}")
|
.setDescription("Legal Name: $commonName\nNearest City: $nearestCity\nEmail: $email\n\n{code}$request{code}")
|
||||||
.setSummary(commonName)
|
.setSummary(commonName)
|
||||||
.setFieldValue(requestIdField.id, requestId)
|
.setFieldValue(requestIdField.id, requestId)
|
||||||
// This will block until the jira is created.
|
// This will block until the issue is created.
|
||||||
jiraClient.issueClient.createIssue(issue.build()).fail { logger.error("Exception when creating JIRA issue.", it) }.claim()
|
jiraClient.issueClient.createIssue(issue.build()).fail { logger.error("Exception when creating JIRA issue.", it) }.claim()
|
||||||
}
|
}
|
||||||
return requestId
|
return requestId
|
||||||
|
Loading…
Reference in New Issue
Block a user