Skip to content

Commit

Permalink
MOSIP-36145: Integration of ROOT and Intermediate CA Certificates
Browse files Browse the repository at this point in the history
Signed-off-by: Swetha K <[email protected]>
  • Loading branch information
Swetha K committed Dec 12, 2024
1 parent 2fd0017 commit e869ef5
Show file tree
Hide file tree
Showing 16 changed files with 358 additions and 318 deletions.
31 changes: 17 additions & 14 deletions pmp-revamp-ui/public/i18n/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -560,27 +560,30 @@
"headerMsg": "هل تريد إلغاء تنشيط شريحة FTM؟ ",
"description": "عند النقر فوق تأكيد، سيتم إلغاء تنشيط تفاصيل شريحة FTM الخاصة بك."
},
"rootTrustCertificate": {
"certificatesList": {
"rootCA": "CA جذر",
"intermediateCA": "CA متوسط",
"certificateTrustStore": "مخزن شهادات الثقة",
"rootOfTrustCertificates": "جذر شهادات الثقة",
"intermediateRootTrustCertificates":"شهادات ثقة الجذر المتوسطة",
"certificateId": "معرف الشهادة",
"partnerDomain": "مجال الشريك",
"issuedTo": "صدر ل",
"issuedBy": "صادرة عن",
"validFrom": "صالح من",
"validTill": "صالح حتى",
"timeOfUpload": "وقت التحميل",
"timeOfUpload": "تاريخ ووقت التحميل",
"status": "حالة",
"action": "فعل",
"UploadCertBtn": "تحميل الشهادة",
"listOfCertificates": "قائمة شهادات جذر الثقة",
"selectCertificateId": "حدد معرف الشهادة",
"selectPartnerDomain": "حدد مجال الشريك",
"selectIssuedTo": "حدد صدر إلى",
"selectIssuedBy": "اختر جهة الإصدار",
"searchCertificateId": "معرف شهادة البحث",
"selectPartnerDomain": "تحديد نطاق الشريك",
"searchIssuedTo": "البحث عن الجهة الصادرة",
"searchIssuedBy": "البحث عن الجهة الصادرة",
"selectStatus": "حدد الحالة",
"deActivate": "إلغاء التنشيط",
"view": "منظر"
"view": "منظر",
"errorInCertificateList": "أثناء جلب الشهادات، واجهنا خطأً."
},
"uploadRootofTrustCertificate": {
"uploadRootofTrustCertificate": "تحميل شهادة جذر الثقة",
Expand All @@ -589,13 +592,13 @@
"dropdownPlaceholder": "حدد مجال الشريك",
"successMsg": "تم تحميل شهادة جذر الثقة لـ {{partnerDomain}} بنجاح"
},
"rootTrustCertificateList": {
"rootTrustCertificateList": "قائمة جذر شهادات الثقة",
"rootOfTrustCertificates": "شهادات الثقة الجذرية",
"caCertificates": "شهادات كاليفورنيا"
"rootCertificateList": {
"uploadRootCaCertificate": "تحميل شهادة CA الجذرية",
"subTitle": "قائمة شهادات CA الجذرية"
},
"intermediateTrustCertificateList": {
"intermediateRootTrustCertificates": "شهادات ثقة الجذر المتوسطة"
"intermediateCertificateList": {
"uploadIntermediateCaCertificate": "تحميل شهادة CA الوسيطة",
"subTitle": "قائمة شهادات CA الوسيطة"
},
"partnerList": {
"partnerTitle": "الشركاء",
Expand Down
32 changes: 17 additions & 15 deletions pmp-revamp-ui/public/i18n/eng.json
Original file line number Diff line number Diff line change
Expand Up @@ -555,27 +555,30 @@
"headerMsg": "Do you want to deactivate FTM Chip ",
"description": "On clicking Confirm, your FTM Chip details will be deactivated."
},
"rootTrustCertificate": {
"certificatesList": {
"rootCA": "Root CA",
"intermediateCA": "Intermediate CA",
"certificateTrustStore": "Certificate Trust Store",
"rootOfTrustCertificates": "Root of Trust Certificates",
"intermediateRootTrustCertificates": "Intermediate Root Trust Certificates",
"certificateId": "Certificate Id",
"certificateId": "Certificate ID",
"partnerDomain": "Partner Domain",
"issuedTo": "Issued To",
"issuedBy": "Issued By",
"validFrom": "Valid From",
"validTill": "Valid Till",
"timeOfUpload": "Time of Upload",
"timeOfUpload": "Upload Date & Time",
"status": "Status",
"action": "Action",
"UploadCertBtn": "Upload Certificate",
"listOfCertificates": "List of Root of Trust certificates",
"selectCertificateId": "Select Certificate Id",
"searchCertificateId": "Search Certificate ID",
"selectPartnerDomain": "Select Partner Domain",
"selectIssuedTo": "Select Issued To",
"selectIssuedBy": "Select Issued By",
"searchIssuedTo": "Search Issued To",
"searchIssuedBy": "Search Issued By",
"selectStatus": "Select Status",
"deActivate": "Deactivate",
"view": "View"
"view": "View",
"errorInCertificateList": "While fetching certificates, we have encountered with an error."
},
"uploadRootofTrustCertificate": {
"uploadRootofTrustCertificate": "Upload Root of Trust Certificate",
Expand All @@ -585,14 +588,13 @@
"dropdownPlaceholder": "Select partner domain",
"successMsg": "Root of Trust Certificate for {{partnerDomain}} is uploaded successfully"
},
"rootTrustCertificateList": {
"rootTrustCertificateList": "List of Root of Trust Certificates",
"rootOfTrustCertificates": "Root Trust Certificates",
"caCertificates": "Ca Certificates"
"rootCertificateList": {
"uploadRootCaCertificate": "Upload Root CA Certificate",
"subTitle": "List of Root CA Certificates"
},
"intermediateTrustCertificateList": {
"intermediateRootTrustCertificates": "Intermediate Root Trust Certificates",
"intermediateRootTrustCertificateList": "List of Root of Trust Certificates"
"intermediateCertificateList": {
"uploadIntermediateCaCertificate": "Upload Intermediate CA Certificate",
"subTitle": "List of Intermediate CA Certificates"
},
"partnerList": {
"partnerTitle": "Partners",
Expand Down
31 changes: 17 additions & 14 deletions pmp-revamp-ui/public/i18n/fra.json
Original file line number Diff line number Diff line change
Expand Up @@ -560,27 +560,30 @@
"headerMsg": "Voulez-vous désactiver la puce FTM ",
"description": "En cliquant sur Confirmer, les détails de votre puce FTM seront désactivés."
},
"rootTrustCertificate": {
"certificatesList": {
"rootCA": "CA racine",
"intermediateCA": "CA intermédiaire",
"certificateTrustStore": "Magasin de certificats de confiance",
"rootOfTrustCertificates": "Certificats racine de confiance",
"intermediateRootTrustCertificates":"Certificats de confiance racine intermédiaires",
"certificateId": "Id du certificat",
"partnerDomain": "Domaine partenaire",
"issuedTo": "Délivré à",
"issuedBy": "Délivré par",
"validFrom": "Valable à partir de",
"validTill": "Valable jusqu'à",
"timeOfUpload": "Heure de téléchargement",
"timeOfUpload": "Date et heure de téléchargement",
"status": "Statut",
"action": "Action",
"UploadCertBtn": "Télécharger le certificat",
"listOfCertificates": "Liste des certificats Root of Trust",
"selectCertificateId": "Sélectionnez l'identifiant du certificat",
"selectPartnerDomain": "Sélectionnez un domaine partenaire",
"selectIssuedTo": "Sélectionnez Délivré à",
"selectIssuedBy": "Sélectionnez Publié par",
"searchCertificateId": "Rechercher l'ID du certificat",
"selectPartnerDomain": "Sélectionner le domaine du partenaire",
"searchIssuedTo": "Rechercher émis à",
"searchIssuedBy": "Rechercher émis par",
"selectStatus": "Sélectionnez le statut",
"deActivate": "Désactiver",
"view": "Voir"
"view": "Voir",
"errorInCertificateList": "Lors de la récupération des certificats, nous avons rencontré une erreur."
},
"uploadRootofTrustCertificate": {
"uploadRootofTrustCertificate": "Télécharger le certificat racine de confiance",
Expand All @@ -589,13 +592,13 @@
"dropdownPlaceholder": "Sélectionnez un domaine partenaire",
"successMsg": "Le certificat racine de confiance pour {{partnerDomain}} a été téléchargé avec succès"
},
"rootTrustCertificateList": {
"rootTrustCertificateList": "Liste des certificats racine de confiance",
"rootOfTrustCertificates": "Certificats de confiance racine",
"caCertificates": "Certificats CA"
"rootCertificateList": {
"uploadRootCaCertificate": "Télécharger le certificat d'autorité de certification racine",
"subTitle": "Liste des certificats d'autorité de certification racine"
},
"intermediateTrustCertificateList": {
"intermediateRootTrustCertificates": "Certificats de confiance racine intermédiaires"
"intermediateCertificateList": {
"uploadIntermediateCaCertificate": "Télécharger le certificat d'autorité de certification intermédiaire",
"subTitle": "Liste des certificats d'autorité de certification intermédiaire"
},
"partnerList":{
"partnerTitle": "Partenaires",
Expand Down
12 changes: 6 additions & 6 deletions pmp-revamp-ui/src/AppRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ import AdminSbiList from './pages/admin/deviceProviderServices/AdminSbiList.js';
import AdminDevicesList from './pages/admin/deviceProviderServices/AdminDevicesList.js';
import ViewAdminSbiDetails from './pages/admin/deviceProviderServices/ViewAdminSbiDetails.js';
import ViewAdminDeviceDetails from './pages/admin/deviceProviderServices/ViewAdminDeviceDetails.js';
import RootTrustCertificatesList from './pages/admin/certificates/RootTrustCertificatesList.js';
import IntermediateRootTrustCertificatesList from './pages/admin/certificates/IntermediateRootTrustCertificatesList.js';
import RootCertificatesList from './pages/admin/certificates/RootCertificatesList.js';
import IntermediateCertificatesList from './pages/admin/certificates/IntermediateCertificatesList.js';

function AppRoutes() {

Expand Down Expand Up @@ -149,12 +149,12 @@ function AppRoutes() {
element: <GuardedRoute><MainLayout><ViewFtmChipDetails /></MainLayout></GuardedRoute>
},
{
path: 'admin/certificates/root-trust-certificate-list',
element: <GuardedRoute><MainLayout><RootTrustCertificatesList /></MainLayout></GuardedRoute>
path: 'admin/certificates/root-ca-certificate-list',
element: <GuardedRoute><MainLayout><RootCertificatesList /></MainLayout></GuardedRoute>
},
{
path: 'admin/certificates/intermediate-root-trust-certificate-list',
element: <GuardedRoute><MainLayout><IntermediateRootTrustCertificatesList /></MainLayout></GuardedRoute>
path: 'admin/certificates/intermediate-ca-certificate-list',
element: <GuardedRoute><MainLayout><IntermediateCertificatesList /></MainLayout></GuardedRoute>
},
{
path: 'admin/certificates/upload-root-trust-certificate',
Expand Down
2 changes: 1 addition & 1 deletion pmp-revamp-ui/src/nav/SideNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function SideNav({ open, policyRequiredPartnerTypes, partnerType }) {
navigate('/partnermanagement/ftm-chip-provider-services/ftm-list');
};
const showRootOfTrustCertificate = () => {
navigate('/partnermanagement/admin/certificates/root-trust-certificate-list');
navigate('/partnermanagement/admin/certificates/root-ca-certificate-list');
};
const showPartner = () => {
navigate('/partnermanagement/admin/partners-list');
Expand Down
41 changes: 41 additions & 0 deletions pmp-revamp-ui/src/pages/admin/certificates/CertificateTab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { onPressEnterKey } from '../../../utils/AppUtils';

function CertificateTab({ activeRootCA, rootCertificatesPath, activeIntermediateCA, intermediateCertificatesPath }) {

const { t } = useTranslation();
const navigate = useNavigate();

const changeToRootCA = () => {
navigate(rootCertificatesPath)
};

const changeToIntermediateCA = () => {
navigate(intermediateCertificatesPath)
};

return (
<div className='flex text-xs bg-[#FCFCFC] font-bold space-x-16 items-start rounded-lg px-[1.5%] pt-[2%] mt-3'>
<div className={`flex-col justify-center text-center`}>
<h6 id='root_of_trust_certificates_tab' onClick={changeToRootCA}
className={`${activeRootCA ? "text-[#1447b2]" : "text-[#031640]"} mb-[12%] cursor-pointer text-sm`}
tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, changeToRootCA)}>
{t('certificatesList.rootCA')}
</h6>
<div className={`h-1 w-24 ${activeRootCA ? "bg-tory-blue" : "bg-transparent"} rounded-t-md`}></div>
</div>
<div className={`flex-col justify-center text-center`}>
<h6 id='intermediate_root_of_trust_certificates_tab' onClick={changeToIntermediateCA}
className={`${activeIntermediateCA ? "text-[#1447b2]" : "text-[#031640]"} mb-[7%] cursor-pointer text-sm`}
tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, changeToIntermediateCA)}>
{t('certificatesList.intermediateCA')}
</h6>
<div className={`h-1 w-32 ${activeIntermediateCA ? "bg-tory-blue" : "bg-transparent"} rounded-t-md`}></div>
</div>
</div>
)
}

export default CertificateTab;
128 changes: 128 additions & 0 deletions pmp-revamp-ui/src/pages/admin/certificates/CertificatesFilter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@

import { useState, useEffect } from 'react';
import DropdownComponent from '../../common/fields/DropdownComponent.js';
import { useTranslation } from 'react-i18next';
import { createDropdownData, isLangRTL } from '../../../utils/AppUtils.js';
import TextInputComponent from '../../common/fields/TextInputComponent.js';
import { getUserProfile } from '../../../services/UserProfileService.js';

function CertificatesFilter({ onApplyFilter }) {
const { t } = useTranslation();
const isLoginLanguageRTL = isLangRTL(getUserProfile().langCode);
const [partnerDomainData, setPartnerDomainData] = useState([]);
const [partnerDomainDropdownData, setPartnerDomainDropdownData] = useState([
{ partnerDomain: 'FTM' },
{ partnerDomain: 'DEVICE' },
{ partnerDomain: 'AUTH' }
]);
const [statusData, setStatusData] = useState([]);
const [statusDropdownData, setStatusDropdownData] = useState([
{ status: 'active' },
{ status: 'deactivated' }
]);
const [filters, setFilters] = useState({
certificateId: "",
partnerDomain: "",
issuedTo: "",
issuedBy: "",
status: "",
});

useEffect(() => {
const fetchData = async () => {
setPartnerDomainData(
createDropdownData("partnerDomain", "", true, partnerDomainDropdownData, t, t("certificatesList.selectPartnerDomain"))
);
setStatusData(
createDropdownData("status", "", true, statusDropdownData, t, t("partnerList.selectStatus"))
);
};
fetchData();
}, [t]);

const onFilterChangeEvent = (fieldName, selectedFilter) => {
setFilters((prevFilters) => ({
...prevFilters,
[fieldName]: selectedFilter
}));
};

const areFiltersEmpty = () => {
return Object.values(filters).every(value => value === "");
};

const styles = {
dropdownButton: "min-w-64",
};

const styleSet = {
inputField: "min-w-64",
inputLabel: "mb-2",
outerDiv: "ml-4"
};

return (
<>
<div className="flex w-full p-2 justify-start bg-[#F7F7F7] flex-wrap">
<TextInputComponent
fieldName="certificateId"
onTextChange={onFilterChangeEvent}
fieldNameKey="certificatesList.certificateId"
placeHolderKey="certificatesList.searchCertificateId"
styleSet={styleSet}
id="cert_id_filter"
/>
<DropdownComponent
fieldName="partnerDomain"
dropdownDataList={partnerDomainData}
onDropDownChangeEvent={onFilterChangeEvent}
fieldNameKey="certificatesList.partnerDomain"
placeHolderKey="certificatesList.selectPartnerDomain"
styleSet={styles}
isPlaceHolderPresent={true}
id="cert_partner_domain_filter"
/>
<TextInputComponent
fieldName='issuedTo'
onTextChange={onFilterChangeEvent}
fieldNameKey='certificatesList.issuedTo'
placeHolderKey='certificatesList.searchIssuedTo'
styleSet={styleSet}
id='cert_issued_to_filter'
/>
<TextInputComponent
fieldName='issuedBy'
onTextChange={onFilterChangeEvent}
fieldNameKey='certificatesList.issuedBy'
placeHolderKey='certificatesList.searchIssuedBy'
styleSet={styleSet}
id='cert_issued_by_domain_filter'
/>
<DropdownComponent
fieldName='status'
dropdownDataList={statusData}
onDropDownChangeEvent={onFilterChangeEvent}
fieldNameKey='certificatesList.status'
placeHolderKey='certificatesList.selectStatus'
styleSet={styles}
isPlaceHolderPresent={true}
id='cert_status_filter'
/>
<div className={`mt-6 mr-6 ${isLoginLanguageRTL ? "mr-auto" : "ml-auto"}`}>
<button
id="apply_filter__btn"
onClick={() => onApplyFilter(filters)}
type="button"
disabled={areFiltersEmpty()}
className={`h-10 text-sm font-semibold px-7 text-white rounded-md ml-6
${areFiltersEmpty() ? 'bg-[#A5A5A5] cursor-auto' : 'bg-tory-blue'}`}
>
{t("partnerList.applyFilter")}
</button>
</div>
</div>
</>
);
}

export default CertificatesFilter;
Loading

0 comments on commit e869ef5

Please sign in to comment.