Skip to content

Commit

Permalink
feat: add more information to system tls certificate table (#2447)
Browse files Browse the repository at this point in the history
* feat: add more information to system tls certificate table

Refs: XRDDEV-2185

* fix: system test fixes

Refs: XRDDEV-2185
  • Loading branch information
enelir authored Nov 29, 2024
1 parent cd1ebd1 commit c74d9a3
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 32 deletions.
8 changes: 7 additions & 1 deletion src/security-server/admin-service/ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -690,13 +690,19 @@
}
},
"internalServers": {
"certHash": "Certificate Hash (SHA/1)",
"certHash": "Certificate Hash",
"connTypeUpdated": "Connection type updated",
"connectionInfo": "Connection type for servers in service provider role is set in the Services tab by the service URL (http/https).",
"connectionType": "Connection type",
"ssCertTitle": "Security Server certificate",
"tlsTitle": "Information System TLS certificate"
},
"certificate": {
"hash": "Certificate Hash",
"subjectDistinguishedName": "Subject Distinguished Name",
"notBefore": "Not Before",
"notAfter": "Not After"
},
"keys": {
"addKey": "Add key",
"authDetailsTitle": "AUTH Key details",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,40 +53,61 @@
>
<xrd-button outlined color="primary" @click="upload">
<xrd-icon-base class="xrd-large-button-icon">
<xrd-icon-add />
<xrd-icon-add/>
</xrd-icon-base>
{{ $t('action.add') }}
</xrd-button>
</xrd-file-upload>
</v-card-title>
<div class="cert-table-title pl-4">
{{ $t('internalServers.certHash') }}
</div>
<table class="server-certificates xrd-table">
<template v-if="tlsCertificates && tlsCertificates.length > 0">
<tr v-for="certificate in tlsCertificates" :key="certificate.hash">
<td class="pl-4 pt-2">
<i class="icon-Certificate icon" />
</td>
<td>
<span
v-if="canViewTlsCertDetails"
class="certificate-link"
@click="openCertificate(certificate)"
>{{ $filters.colonize(certificate.hash) }}</span
>
<span v-else>{{ $filters.colonize(certificate.hash) }}</span>
</td>
</tr>

<v-data-table
:loading="tlsCertLoading"
:headers="headers"
:items="tlsCertificates"
:must-sort="true"
:items-per-page="-1"
class="data-table elevation-0"
item-key="id"
:loader-height="2"
hide-default-footer
:no-data-text="$t('noData.noCertificates')"
data-test="tls-certificate-table"
>

<template #[`item.hash`]="{ item }">
<td class="pr-12 pt-2">
<i class="icon-Certificate icon"/>
</td>
<td>
<span
v-if="canViewTlsCertDetails"
class="certificate-link"
@click="openCertificate(item)"
data-test="tls-certificate-link"
>{{ $filters.colonize(item.hash) }}</span>
<span v-else>{{ $filters.colonize(item.hash) }}</span>
</td>
</template>

<XrdEmptyPlaceholderRow
:colspan="2"
:loading="tlsCertLoading"
:data="tlsCertificates"
:no-items-text="$t('noData.noCertificates')"
/>
</table>
<template #[`item.subject_distinguished_name`]="{ item }">
<span data-test="tls-certificate-subject-distinguished-name">
{{ item.subject_distinguished_name }}
</span>
</template>

<template #[`item.not_before`]="{ item }">
<span data-test="tls-certificate-not-before">
{{ $filters.formatDate(item.not_before) }}
</span>
</template>

<template #[`item.not_after`]="{ item }">
<span data-test="tls-certificate-not-after">
{{ $filters.formatDate(item.not_after) }}
</span>
</template>

</v-data-table>
</v-card>

<v-card v-if="canViewSSCert" variant="flat" class="xrd-card pb-4">
Expand Down Expand Up @@ -142,10 +163,11 @@ import { mapActions, mapState } from 'pinia';
import { useNotifications } from '@/store/modules/notifications';
import { useUser } from '@/store/modules/user';
import { useClient } from '@/store/modules/client';
import { FileUploadResult, XrdIconAdd } from '@niis/shared-ui';
import {FileUploadResult, XrdIconAdd, XrdIconFolder} from '@niis/shared-ui';
import {DataTableHeader} from "@/ui-types";

export default defineComponent({
components: { XrdIconAdd },
components: {XrdIconFolder, XrdIconAdd },
props: {
id: {
type: String,
Expand Down Expand Up @@ -173,6 +195,30 @@ export default defineComponent({
'ssCertificate',
'connectionType',
]),
headers(): DataTableHeader[] {
return [
{
title: this.$t('certificate.hash') as string,
align: 'start',
key: 'hash',
},
{
title: this.$t('certificate.subjectDistinguishedName') as string,
align: 'start',
key: 'subject_distinguished_name',
},
{
title: this.$t('certificate.notBefore') as string,
align: 'start',
key: 'not_before',
},
{
title: this.$t('certificate.notAfter') as string,
align: 'start',
key: 'not_after',
},
];
},

connectionTypeModel: {
get(): string | undefined | null {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,14 @@ public void validateConnectionType(String connectionType) {
public void uploadTlsCert() {
clientInfoPageObj.internalServers.inputTlsCertificate().uploadFromClasspath("files/cert.cer");

clientInfoPageObj.internalServers.tlsCertificateSubjectDistinguishedName()
.shouldBe(visible);
clientInfoPageObj.internalServers.linkTLSCertificate()
.shouldBe(visible);

clientInfoPageObj.internalServers.tlsCertificateNotBefore()
.shouldBe(visible);
clientInfoPageObj.internalServers.tlsCertificateNotAfter()
.shouldBe(visible);
}

@Step("Information System TLS certificate is deleted")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,24 @@ public SelenideElement menuConnectionType() {

}

private SelenideElement tlsCertificateTable() {
return $x("//div[@data-test='tls-certificate-table']//table");
}

public SelenideElement linkTLSCertificate() {
return $x("//table[contains(@class, 'server-certificates')]//span[contains(@class, 'certificate-link')]");
return tlsCertificateTable().$x(".//span[@data-test='tls-certificate-link']");
}

public SelenideElement tlsCertificateSubjectDistinguishedName() {
return tlsCertificateTable().$x(".//span[@data-test='tls-certificate-subject-distinguished-name']");
}

public SelenideElement tlsCertificateNotBefore() {
return tlsCertificateTable().$x(".//span[@data-test='tls-certificate-not-before']");
}

public SelenideElement tlsCertificateNotAfter() {
return tlsCertificateTable().$x(".//span[@data-test='tls-certificate-not-after']");
}

public SelenideElement inputTlsCertificate() {
Expand Down

0 comments on commit c74d9a3

Please sign in to comment.