diff --git a/src/gmp/models/__tests__/credential.js b/src/gmp/models/__tests__/credential.js
index e008c0258b..37a7dad2a7 100644
--- a/src/gmp/models/__tests__/credential.js
+++ b/src/gmp/models/__tests__/credential.js
@@ -23,7 +23,6 @@ import {setLocale} from 'gmp/locale/lang';
import Model from 'gmp/model';
import Credential, {
- CLIENT_CERTIFICATE_CREDENTIAL_TYPE,
SNMP_CREDENTIAL_TYPE,
USERNAME_PASSWORD_CREDENTIAL_TYPE,
USERNAME_SSH_KEY_CREDENTIAL_TYPE,
@@ -47,15 +46,11 @@ const USERNAME_PASSWORD_CREDENTIAL = Credential.fromElement({
const USERNAME_SSH_KEY_CREDENTIAL = Credential.fromElement({
type: USERNAME_SSH_KEY_CREDENTIAL_TYPE,
});
-const CLIENT_CERTIFICATE_CREDENTIAL = Credential.fromElement({
- type: CLIENT_CERTIFICATE_CREDENTIAL_TYPE,
-});
const SNMP_CREDENTIAL = Credential.fromElement({type: SNMP_CREDENTIAL_TYPE});
const PGP_CREDENTIAL = Credential.fromElement({type: PGP_CREDENTIAL_TYPE});
const SMIME_CREDENTIAL = Credential.fromElement({type: SMIME_CREDENTIAL_TYPE});
const createAllCredentials = () => [
- CLIENT_CERTIFICATE_CREDENTIAL,
USERNAME_PASSWORD_CREDENTIAL,
USERNAME_SSH_KEY_CREDENTIAL,
SNMP_CREDENTIAL,
@@ -151,7 +146,6 @@ describe('Credential Model tests', () => {
describe('Credential model function tests', () => {
test('ssh_credential_filter should return filter with correct true/false', () => {
- expect(ssh_credential_filter(CLIENT_CERTIFICATE_CREDENTIAL)).toEqual(false);
expect(ssh_credential_filter(USERNAME_SSH_KEY_CREDENTIAL)).toEqual(true);
expect(ssh_credential_filter(USERNAME_PASSWORD_CREDENTIAL)).toEqual(true);
});
@@ -167,9 +161,6 @@ describe('Credential model function tests', () => {
});
test('snmp_credential_filter should return filter with correct true/false', () => {
- expect(snmp_credential_filter(CLIENT_CERTIFICATE_CREDENTIAL)).toEqual(
- false,
- );
expect(snmp_credential_filter(SNMP_CREDENTIAL)).toEqual(true);
});
@@ -231,9 +222,6 @@ describe('getCredentialTypeName tests', () => {
expect(getCredentialTypeName(USERNAME_SSH_KEY_CREDENTIAL_TYPE)).toEqual(
'Username + SSH Key',
);
- expect(getCredentialTypeName(CLIENT_CERTIFICATE_CREDENTIAL_TYPE)).toEqual(
- 'Client Certificate',
- );
expect(getCredentialTypeName(SNMP_CREDENTIAL_TYPE)).toEqual('SNMP');
expect(getCredentialTypeName(SMIME_CREDENTIAL_TYPE)).toEqual(
'S/MIME Certificate',
diff --git a/src/gmp/models/credential.js b/src/gmp/models/credential.js
index 7ff443ebe6..738a8ed44b 100644
--- a/src/gmp/models/credential.js
+++ b/src/gmp/models/credential.js
@@ -26,7 +26,6 @@ import {parseYesNo, NO_VALUE, parseDate} from 'gmp/parser';
export const USERNAME_PASSWORD_CREDENTIAL_TYPE = 'up';
export const USERNAME_SSH_KEY_CREDENTIAL_TYPE = 'usk';
-export const CLIENT_CERTIFICATE_CREDENTIAL_TYPE = 'cc';
export const SNMP_CREDENTIAL_TYPE = 'snmp';
export const SMIME_CREDENTIAL_TYPE = 'smime';
export const PGP_CREDENTIAL_TYPE = 'pgp';
@@ -55,7 +54,6 @@ export const VFIRE_CREDENTIAL_TYPES = [USERNAME_PASSWORD_CREDENTIAL_TYPE];
export const ALL_CREDENTIAL_TYPES = [
USERNAME_PASSWORD_CREDENTIAL_TYPE,
USERNAME_SSH_KEY_CREDENTIAL_TYPE,
- CLIENT_CERTIFICATE_CREDENTIAL_TYPE,
SNMP_CREDENTIAL_TYPE,
SMIME_CREDENTIAL_TYPE,
PGP_CREDENTIAL_TYPE,
diff --git a/src/web/pages/credentials/__tests__/detailspage.js b/src/web/pages/credentials/__tests__/detailspage.js
index c2501a1f53..2abfcd9714 100644
--- a/src/web/pages/credentials/__tests__/detailspage.js
+++ b/src/web/pages/credentials/__tests__/detailspage.js
@@ -76,22 +76,15 @@ const credential = Credential.fromElement({
allow_insecure: 1,
creation_time: '2020-12-16T15:23:59Z',
comment: 'blah',
- formats: {format: 'pem'},
- full_type: 'client certificate',
+ full_type: 'Username + SSH Key',
in_use: 0,
login: '',
modification_time: '2021-03-02T10:28:15Z',
name: 'credential 1',
owner: {name: 'admin'},
permissions: {permission: {name: 'Everything'}},
- type: 'cc',
+ type: 'usk',
writable: 1,
- certificate_info: {
- activation_time: '2018-10-10T11:41:23.022Z',
- expiration_time: '2019-10-10T11:41:23.022Z',
- md5_fingerprint: 'asdf',
- issuer: 'dn',
- },
});
const noPermCredential = Credential.fromElement({
@@ -99,22 +92,15 @@ const noPermCredential = Credential.fromElement({
allow_insecure: 1,
creation_time: '2020-12-16T15:23:59Z',
comment: 'blah',
- formats: {format: 'pem'},
- full_type: 'client certificate',
+ full_type: 'Username + SSH Key',
in_use: 0,
login: '',
modification_time: '2021-03-02T10:28:15Z',
name: 'credential 1',
owner: {name: 'admin'},
permissions: {permission: {name: 'get_credentials'}},
- type: 'cc',
+ type: 'usk',
writable: 1,
- certificate_info: {
- activation_time: '2018-10-10T11:41:23.022Z',
- expiration_time: '2019-10-10T11:41:23.022Z',
- md5_fingerprint: 'asdf',
- issuer: 'dn',
- },
});
const credentialInUse = Credential.fromElement({
@@ -122,22 +108,15 @@ const credentialInUse = Credential.fromElement({
allow_insecure: 1,
creation_time: '2020-12-16T15:23:59Z',
comment: 'blah',
- formats: {format: 'pem'},
- full_type: 'client certificate',
+ full_type: 'Username + SSH Key',
in_use: 1,
login: '',
modification_time: '2021-03-02T10:28:15Z',
name: 'credential 1',
owner: {name: 'admin'},
permissions: {permission: {name: 'Everything'}},
- type: 'cc',
+ type: 'usk',
writable: 1,
- certificate_info: {
- activation_time: '2018-10-10T11:41:23.022Z',
- expiration_time: '2019-10-10T11:41:23.022Z',
- md5_fingerprint: 'asdf',
- issuer: 'dn',
- },
});
describe('Credential Detailspage tests', () => {
@@ -186,31 +165,19 @@ describe('Credential Detailspage tests', () => {
expect(element).toHaveTextContent('Owner:admin');
const spans = baseElement.querySelectorAll('span');
- expect(spans[10]).toHaveTextContent('User Tags');
- expect(spans[12]).toHaveTextContent('Permissions');
+ expect(spans[12]).toHaveTextContent('User Tags');
+ expect(spans[14]).toHaveTextContent('Permissions');
expect(element).toHaveTextContent('Comment');
expect(element).toHaveTextContent('blah');
expect(element).toHaveTextContent('Type');
- expect(element).toHaveTextContent('Client Certificate(cc)');
+ expect(element).toHaveTextContent('Username + SSH Key');
expect(element).toHaveTextContent('Allow Insecure Use');
expect(element).toHaveTextContent('Yes');
- expect(element).toHaveTextContent('Certificate');
-
- expect(element).toHaveTextContent('Activation');
- expect(element).toHaveTextContent('Wed, Oct 10, 2018 1:41 PM CEST');
-
- expect(element).toHaveTextContent('Expiration');
- expect(element).toHaveTextContent('Thu, Oct 10, 2019 1:41 PM CEST');
-
- expect(element).toHaveTextContent('MD5 Fingerprint');
- expect(element).toHaveTextContent('asdf');
-
- expect(element).toHaveTextContent('Issued By');
- expect(element).toHaveTextContent('dn');
+ expect(element).toHaveTextContent('Login');
});
test('should render user tags tab', () => {
@@ -243,9 +210,9 @@ describe('Credential Detailspage tests', () => {
const {baseElement} = render();
const spans = baseElement.querySelectorAll('span');
- expect(spans[10]).toHaveTextContent('User Tags');
+ expect(spans[12]).toHaveTextContent('User Tags');
- fireEvent.click(spans[10]);
+ fireEvent.click(spans[12]);
expect(baseElement).toHaveTextContent('No user tags available');
});
@@ -280,9 +247,9 @@ describe('Credential Detailspage tests', () => {
const {baseElement} = render();
const spans = baseElement.querySelectorAll('span');
- expect(spans[12]).toHaveTextContent('Permissions');
+ expect(spans[14]).toHaveTextContent('Permissions');
- fireEvent.click(spans[12]);
+ fireEvent.click(spans[14]);
expect(baseElement).toHaveTextContent('No permissions available');
});
@@ -428,9 +395,7 @@ describe('Credential ToolBarIcons tests', () => {
const editIcon = screen.getAllByTitle('Edit Credential');
const deleteIcon = screen.getAllByTitle('Move Credential to trashcan');
const exportIcon = screen.getAllByTitle('Export Credential as XML');
- const exportCredentialInstallerIcon = screen.getAllByTitle(
- 'Download Certificate (.pem)',
- );
+ const downloadPublicKeyIcon = screen.getAllByTitle('Download Public Key');
expect(cloneIcon[0]).toBeInTheDocument();
fireEvent.click(cloneIcon[0]);
@@ -448,11 +413,11 @@ describe('Credential ToolBarIcons tests', () => {
fireEvent.click(exportIcon[0]);
expect(handleCredentialDownloadClick).toHaveBeenCalledWith(credential);
- expect(exportCredentialInstallerIcon[0]).toBeInTheDocument();
- fireEvent.click(exportCredentialInstallerIcon[0]);
+ expect(downloadPublicKeyIcon[0]).toBeInTheDocument();
+ fireEvent.click(downloadPublicKeyIcon[0]);
expect(handleCredentialInstallerDownloadClick).toHaveBeenCalledWith(
credential,
- 'pem',
+ 'key',
);
});
diff --git a/src/web/pages/credentials/__tests__/dialog.js b/src/web/pages/credentials/__tests__/dialog.js
index fbda04fabb..5a86c3566d 100644
--- a/src/web/pages/credentials/__tests__/dialog.js
+++ b/src/web/pages/credentials/__tests__/dialog.js
@@ -42,14 +42,14 @@ const credential = Credential.fromElement({
creation_time: '2020-12-16T15:23:59Z',
comment: 'blah',
formats: {format: 'pem'},
- full_type: 'client certificate',
+ full_type: 'Username + SSH Key',
in_use: 0,
login: '',
modification_time: '2021-03-02T10:28:15Z',
name: 'credential 1',
owner: {name: 'admin'},
permissions: {permission: {name: 'Everything'}},
- type: 'cc',
+ type: 'usk',
writable: 1,
});
@@ -134,7 +134,7 @@ describe('CredentialsDialog component tests', () => {
expect(commentInput).toHaveAttribute('value', 'blah');
expect(formGroups[2]).toHaveTextContent('Type');
- expect(selectedValue).toHaveTextContent('Client Certificate');
+ expect(selectedValue).toHaveTextContent('Username + SSH Key');
const allowInsecure = getAllByName('allow_insecure');
expect(formGroups[3]).toHaveTextContent('Allow insecure use');
@@ -217,8 +217,8 @@ describe('CredentialsDialog component tests', () => {
const selectItems = getAllByTestId('select-item');
- expect(selectItems.length).toBe(7);
- fireEvent.click(selectItems[6]);
+ expect(selectItems.length).toBe(6);
+ fireEvent.click(selectItems[5]);
expect(selectedValues[0]).toHaveTextContent('Password only');
@@ -298,40 +298,6 @@ describe('CredentialsDialog component tests', () => {
expect(privateKey).toHaveAttribute('type', 'file');
});
- test('should render form fields for Client Certificate', () => {
- const {render} = rendererWith({
- capabilities: true,
- });
-
- const {getAllByTestId, getByName} = render(
- ,
- );
-
- const selectedValues = getAllByTestId('select-selected-value');
-
- expect(selectedValues[0]).toHaveTextContent('Client Certificate');
-
- const formGroups = getAllByTestId('formgroup-title');
-
- const password = getByName('passphrase');
- expect(formGroups[4]).toHaveTextContent('Passphrase');
- expect(password).toHaveAttribute('value', '');
-
- const certificate = getByName('certificate');
- expect(formGroups[5]).toHaveTextContent('Certificate');
- expect(certificate).toHaveAttribute('type', 'file');
-
- const privateKey = getByName('private_key');
- expect(formGroups[6]).toHaveTextContent('Private Key');
- expect(privateKey).toHaveAttribute('type', 'file');
- });
-
test('should render form fields for SNMP', () => {
const {render} = rendererWith({
capabilities: true,
diff --git a/src/web/pages/credentials/__tests__/listpage.js b/src/web/pages/credentials/__tests__/listpage.js
index 4236051da1..6e3a732a27 100644
--- a/src/web/pages/credentials/__tests__/listpage.js
+++ b/src/web/pages/credentials/__tests__/listpage.js
@@ -43,14 +43,14 @@ const credential = Credential.fromElement({
creation_time: '2020-12-16T15:23:59Z',
comment: 'blah',
formats: {format: 'pem'},
- full_type: 'client certificate',
+ full_type: 'Username + SSH Key',
in_use: 0,
login: '',
modification_time: '2021-03-02T10:28:15Z',
name: 'credential 1',
owner: {name: 'admin'},
permissions: {permission: {name: 'Everything'}},
- type: 'cc',
+ type: 'usk',
writable: 1,
certificate_info: {
activation_time: '2018-10-10T11:41:23.022Z',
@@ -166,7 +166,7 @@ describe('CredentialPage tests', () => {
expect(row[1]).toHaveTextContent('credential 1');
expect(row[1]).toHaveTextContent('(blah)');
- expect(row[1]).toHaveTextContent('Client Certificate(cc)');
+ expect(row[1]).toHaveTextContent('Username + SSH Key');
expect(row[1]).toHaveTextContent('Yes');
expect(
@@ -175,9 +175,7 @@ describe('CredentialPage tests', () => {
expect(screen.getAllByTitle('Edit Credential')[0]).toBeInTheDocument();
expect(screen.getAllByTitle('Clone Credential')[0]).toBeInTheDocument();
expect(screen.getAllByTitle('Export Credential')[0]).toBeInTheDocument();
- expect(
- screen.getAllByTitle('Download Certificate (.pem)')[0],
- ).toBeInTheDocument();
+ expect(screen.getAllByTitle('Download Public Key')[0]).toBeInTheDocument();
});
test('should allow to bulk action on page contents', async () => {
diff --git a/src/web/pages/credentials/details.js b/src/web/pages/credentials/details.js
index 70b1330772..37fcd82fe5 100644
--- a/src/web/pages/credentials/details.js
+++ b/src/web/pages/credentials/details.js
@@ -20,7 +20,6 @@ import React from 'react';
import _ from 'gmp/locale';
import {
- CLIENT_CERTIFICATE_CREDENTIAL_TYPE,
SNMP_CREDENTIAL_TYPE,
SNMP_PRIVACY_ALOGRITHM_NONE,
getCredentialTypeName,
@@ -86,12 +85,10 @@ const CredentialDetails = ({entity}) => {
- {credential_type !== CLIENT_CERTIFICATE_CREDENTIAL_TYPE && (
-
- {_('Login')}
- {login}
-
- )}
+
+ {_('Login')}
+ {login}
+
{credential_type === SNMP_CREDENTIAL_TYPE && (
{_('Auth Algorithm')}
diff --git a/src/web/pages/credentials/dialog.js b/src/web/pages/credentials/dialog.js
index c509f52106..2749147035 100644
--- a/src/web/pages/credentials/dialog.js
+++ b/src/web/pages/credentials/dialog.js
@@ -26,7 +26,6 @@ import {isDefined} from 'gmp/utils/identity';
import {first, map} from 'gmp/utils/array';
import {
- CLIENT_CERTIFICATE_CREDENTIAL_TYPE,
SNMP_CREDENTIAL_TYPE,
USERNAME_PASSWORD_CREDENTIAL_TYPE,
USERNAME_SSH_KEY_CREDENTIAL_TYPE,
@@ -332,9 +331,7 @@ class CredentialsDialog extends React.Component {
)}
- {(state.credential_type === USERNAME_SSH_KEY_CREDENTIAL_TYPE ||
- state.credential_type ===
- CLIENT_CERTIFICATE_CREDENTIAL_TYPE) && (
+ {state.credential_type === USERNAME_SSH_KEY_CREDENTIAL_TYPE && (
{is_edit && (
@@ -381,15 +378,7 @@ class CredentialsDialog extends React.Component {
)}
- {state.credential_type === CLIENT_CERTIFICATE_CREDENTIAL_TYPE && (
-
-
-
- )}
-
- {(state.credential_type === USERNAME_SSH_KEY_CREDENTIAL_TYPE ||
- state.credential_type ===
- CLIENT_CERTIFICATE_CREDENTIAL_TYPE) && (
+ {state.credential_type === USERNAME_SSH_KEY_CREDENTIAL_TYPE && (
diff --git a/src/web/pages/credentials/downloadicon.js b/src/web/pages/credentials/downloadicon.js
index 52893226ea..59c93c127f 100644
--- a/src/web/pages/credentials/downloadicon.js
+++ b/src/web/pages/credentials/downloadicon.js
@@ -22,7 +22,6 @@ import _ from 'gmp/locale';
import {
USERNAME_PASSWORD_CREDENTIAL_TYPE,
USERNAME_SSH_KEY_CREDENTIAL_TYPE,
- CLIENT_CERTIFICATE_CREDENTIAL_TYPE,
} from 'gmp/models/credential';
import IconDivider from 'web/components/layout/icondivider';
@@ -66,13 +65,6 @@ const CredentialDownloadIcon = ({credential, onDownload}) => {
onClick={cred => onDownload(cred, 'exe')}
/>
)}
- {type === CLIENT_CERTIFICATE_CREDENTIAL_TYPE && (
- onDownload(cred, 'pem')}
- />
- )}
);
};
diff --git a/src/web/pages/scanners/component.js b/src/web/pages/scanners/component.js
index 4a1f65b760..4ef7c37770 100644
--- a/src/web/pages/scanners/component.js
+++ b/src/web/pages/scanners/component.js
@@ -25,8 +25,6 @@ import {isDefined} from 'gmp/utils/identity';
import {shorten} from 'gmp/utils/string';
import {hasId} from 'gmp/utils/id';
-import {CLIENT_CERTIFICATE_CREDENTIAL_TYPE} from 'gmp/models/credential';
-
import {renewSessionTimeout} from 'web/store/usersettings/actions';
import {loadUserSettingDefaults} from 'web/store/usersettings/defaults/actions';
import {getUserSettingsDefaults} from 'web/store/usersettings/defaults/selectors';
@@ -134,12 +132,6 @@ class ScannerComponent extends React.Component {
openCredentialsDialog() {
this.handleInteraction();
-
- this.setState({
- base: CLIENT_CERTIFICATE_CREDENTIAL_TYPE,
- credentialDialogVisible: true,
- credentialTypes: [CLIENT_CERTIFICATE_CREDENTIAL_TYPE],
- });
}
closeCredentialsDialog() {
diff --git a/src/web/pages/scanners/detailspage.js b/src/web/pages/scanners/detailspage.js
index 0661033edc..70ef4500e3 100644
--- a/src/web/pages/scanners/detailspage.js
+++ b/src/web/pages/scanners/detailspage.js
@@ -68,6 +68,8 @@ import PropTypes from 'web/utils/proptypes';
import ScannerComponent from './component';
import ScannerDetails from './details';
+import useGmp from 'web/utils/useGmp';
+
const ToolBarIcons = ({
entity,
onScannerCertificateDownloadClick,
@@ -79,6 +81,7 @@ const ToolBarIcons = ({
onScannerEditClick,
onScannerVerifyClick,
}) => {
+ const gmp = useGmp();
return (
@@ -90,7 +93,9 @@ const ToolBarIcons = ({
-
+ {gmp.settings.enableGreenboneSensor && (
+
+ )}
{
- return credential.credential_type === CLIENT_CERTIFICATE_CREDENTIAL_TYPE;
-};
-
-const render_certificate_info = (info, tz) => {
- if (!isDefined(info)) {
- return null;
- }
-
- if (info.time_status === 'expired') {
- return _('Certificate currently in use expired at {{date}}', {
- date: longDate(info.expirationTime, tz),
- });
- }
- if (info.time_status === 'inactive') {
- return _('Certificate currently not valid until {{date}}', {
- date: longDate(info.activationTime, tz),
- });
- }
- return _('Certificate in use will expire at {{date}}', {
- date: longDate(info.expirationTime, tz),
- });
-};
-
-const mapStateToProps = rootState => ({
- timezone: getTimezone(rootState),
-});
-
-const CertStatus = connect(mapStateToProps)(({info, timezone}) => {
- return (
-
-
-
-
- {render_certificate_info(info, timezone)}
-
- );
-});
-
-CertStatus.propTypes = {
- info: PropTypes.object.isRequired,
-};
-
const ScannerDialog = ({
ca_pub,
comment = '',
@@ -125,16 +71,8 @@ const ScannerDialog = ({
const handleTypeChange = (value, name) => {
if (onScannerTypeChange) {
value = parseInt(value);
- const scan_credentials = filter(
- credentials,
- client_cert_credentials_filter,
- );
onScannerTypeChange(value, name);
- onScannerTypeChange(
- selectSaveId(scan_credentials, credential_id),
- 'credential_id',
- );
}
};
@@ -167,15 +105,8 @@ const ScannerDialog = ({
value: scannerType,
}));
- const scanner_credentials = filter(
- credentials,
- client_cert_credentials_filter,
- );
+ const scanner_credentials = filter(credentials);
const isInUse = isDefined(scanner) && scanner.isInUse();
- const show_cred_info =
- isDefined(scanner) &&
- isDefined(scanner.credential) &&
- scanner.credential.credential_type === CLIENT_CERTIFICATE_CREDENTIAL_TYPE;
const isGreenboneSensorType = type === GREENBONE_SENSOR_SCANNER_TYPE;
@@ -250,9 +181,6 @@ const ScannerDialog = ({
/>
- {show_cred_info && (
-
- )}
)}