diff options
author | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2020-03-27 21:00:50 +0300 |
---|---|---|
committer | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2020-04-09 17:27:04 +0300 |
commit | 532a4b033669497d972683320e3d1d6dde1943f6 (patch) | |
tree | 894243478cd356256b89d102425e1a6ac0174715 /src/store | |
parent | d0d9215bbb3c5b56d682abffb5abb916ff9d4387 (diff) | |
download | webui-vue-532a4b033669497d972683320e3d1d6dde1943f6.tar.xz |
Add generate CSR to SSL certificates page
Adds ability to generate, then download or copy a CSR from the GUI
- Import FormTagsPlugin to use for alternate names field
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I060e8d7917a79dafbfb67c758f5baa4a36ab86ae
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/AccessControl/SslCertificatesStore.js | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/store/modules/AccessControl/SslCertificatesStore.js b/src/store/modules/AccessControl/SslCertificatesStore.js index e1758d3c..ef4afdbb 100644 --- a/src/store/modules/AccessControl/SslCertificatesStore.js +++ b/src/store/modules/AccessControl/SslCertificatesStore.js @@ -1,7 +1,7 @@ import api from '../../api'; import i18n from '../../../i18n'; -const CERTIFICATE_TYPES = [ +export const CERTIFICATE_TYPES = [ { type: 'HTTPS Certificate', location: '/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/', @@ -151,6 +151,52 @@ const SslCertificatesStore = { i18n.t('pageSslCertificates.toast.errorDeleteCertificate') ); }); + }, + async generateCsr(_, userData) { + const { + certificateType, + country, + state, + city, + companyName, + companyUnit, + commonName, + keyPairAlgorithm, + keyBitLength, + keyCurveId, + challengePassword, + contactPerson, + emailAddress, + alternateName + } = userData; + const data = {}; + + data.CertificateCollection = { + '@odata.id': getCertificateProp(certificateType, 'location') + }; + data.Country = country; + data.State = state; + data.City = city; + data.Organization = companyName; + data.OrganizationalUnit = companyUnit; + data.CommonName = commonName; + data.KeyPairAlgorithm = keyPairAlgorithm; + data.AlternativeNames = alternateName; + + if (keyCurveId) data.KeyCurveId = keyCurveId; + if (keyBitLength) data.KeyBitLength = keyBitLength; + if (challengePassword) data.ChallengePassword = challengePassword; + if (contactPerson) data.ContactPerson = contactPerson; + if (emailAddress) data.Email = emailAddress; + + return await api + .post( + '/redfish/v1/CertificateService/Actions/CertificateService.GenerateCSR', + data + ) + //TODO: Success response also throws error so + // can't accurately show legitimate error in UI + .catch(error => console.log(error)); } } }; |