Skip to content

Commit

Permalink
feat: check option and hide certificates and private key settings on …
Browse files Browse the repository at this point in the history
…default
  • Loading branch information
biancode committed Oct 29, 2018
1 parent 0dc1267 commit 0f68a40
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 32 deletions.
5 changes: 3 additions & 2 deletions src/locales/de-DE/opcua-iiot-connector.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
"certificateFiles": "Zertifikatdateien",
"endpointMustExist": "Endpoint muss exakt sein",
"autoSelectRightEndpoint": "Automatische Endpoint-Auswahl",
"showErrors": "Zeige Fehler"
"showErrors": "Zeige Fehler",
"individualCerts": "Nutze individuelle Zertifikate"
},
"tabs-label": {
"settings": "Einstellungen",
"security": "Sicherheit",
"strategy": "Strategie"
}
}
}
}
3 changes: 2 additions & 1 deletion src/locales/de-DE/opcua-iiot-flex-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"publicCertificateFile": "Öffentlich",
"privateCertificateFile": "Privat",
"certificateFiles": "Zertifikatdateien",
"users": "Benutzer"
"users": "Benutzer",
"individualCerts": "Nutze individuelle Zertifikate"
},
"tabs-label": {
"users": "Benutzer & Sets",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/de-DE/opcua-iiot-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"publicCertificateFile": "Öffentlich",
"privateCertificateFile": "Privat",
"certificateFiles": "Zertifikatdateien",
"users": "Benutzer"
"users": "Benutzer",
"individualCerts": "Nutze individuelle Zertifikate"
},
"tabs-label": {
"users": "Benutzer & Sets",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en-US/opcua-iiot-connector.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"reconnectDelay": "Reconnect",
"connectionStopDelay": "Stop",
"serverConnectionDelays": "Server Connection Delays",
"maxBadSessionRequests": "Max. BadSession Requests"
"maxBadSessionRequests": "Max. BadSession Requests",
"individualCerts": "Use individual Certificate Files"
},
"tabs-label": {
"settings": "Settings",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en-US/opcua-iiot-flex-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"registerServerMethod": "Register Server Method",
"discoveryServerEndpointUrl": "Endpoint Url",
"capabilitiesForMDNS": "MDNS capabilities",
"delayToClose": "Delay On Close"
"delayToClose": "Delay On Close",
"individualCerts": "Use individual Certificate Files"
},
"tabs-label": {
"users": "Users & Sets",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en-US/opcua-iiot-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"registerServerMethod": "Register Server Method",
"discoveryServerEndpointUrl": "Endpoint Url",
"capabilitiesForMDNS": "MDNS capabilities",
"delayToClose": "Delay On Close"
"delayToClose": "Delay On Close",
"individualCerts": "Use individual Certificate Files"
},
"tabs-label": {
"users": "Users & Sets",
Expand Down
54 changes: 47 additions & 7 deletions src/opcua-iiot-connector.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
securityMode: {value: 'NONE', required: true},
name: {value: "LOCAL SERVER"},
showErrors: {value: false},
individualCerts: {value: false},
publicCertificateFile: {value: ''},
privateKeyFile: {value: ''},
defaultSecureTokenLifetime: {value: ''},
Expand Down Expand Up @@ -67,6 +68,7 @@
label: this._("opcua-iiot-contrib.tabs-label.strategy")
})


// Security Management
try {
let loginCheckbox = $("#node-config-input-loginEnabled");
Expand Down Expand Up @@ -94,6 +96,33 @@
this.error(err);
}

// Certificate Management
try {
let certsCheckbox = $("#node-config-input-individualCerts");
let configCertFields = $("#node-config-certFiles");

if (this.individualCerts) {
certsCheckbox.prop('checked', true);
configCertFields.show();
} else {
certsCheckbox.prop('checked', false);
configCertFields.hide();
}

certsCheckbox.change(function () {
if ($(this).is(":checked")) {
configCertFields.show();
} else {
configCertFields.hide();
$('#node-config-input-publicCertificateFile').val('');
$('#node-config-input-privateKeyFile').val('');
}
});

} catch (err) {
this.error(err);
}

let discoveryLookupButton = $("#node-config-lookup-discovery")
let discoveryUrlField = $("#node-config-input-discoveryUrl")

Expand Down Expand Up @@ -252,14 +281,25 @@
</label>
</div>
<div class="form-row">
<label for="node-config-input-publicCertificateFile"><i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.publicCertificateFile"></span></label>
<input type="text" id="node-config-input-publicCertificateFile" placeholder="./certificates/client_selfsigned_cert_1024.pem" style="min-width:480px">
<label style="min-width:240px">
<i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.individualCerts"></span>
<input type="checkbox" id="node-config-input-individualCerts" style="max-width:30px">
</label>
</div>
<div class="form-row">
<label for="node-config-input-privateKeyFile"><i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.privateKeyFile"></span></label>
<input type="text" id="node-config-input-privateKeyFile" placeholder="./certificates/PKI/own/private/private_key.pem" style="min-width:480px">
<div id="node-config-certFiles">
<hr>
<div class="form-row">
<label for="node-config-input-publicCertificateFile"><i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.publicCertificateFile"></span></label>
<input type="text" id="node-config-input-publicCertificateFile" placeholder="./certificates/client_selfsigned_cert_1024.pem" style="min-width:480px">
</div>
<div class="form-row">
<label for="node-config-input-privateKeyFile"><i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.privateKeyFile"></span></label>
<input type="text" id="node-config-input-privateKeyFile" placeholder="./certificates/PKI/own/private/private_key.pem" style="min-width:480px">
</div>
<hr>
</div>
<div class="form-row">
<label for="node-config-input-defaultSecureTokenLifetime"><i class="fa fa-file"></i>
Expand Down
56 changes: 47 additions & 9 deletions src/opcua-iiot-flex-server.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
defaults: {
port: {value: '55380', required: true},
endpoint: {value: ''},
acceptExternalCommands: {value: true, required: true},
acceptExternalCommands: {value: true},
maxAllowedSessionNumber: {value: ''},
maxConnectionsPerEndpoint: {value: ''},
maxAllowedSubscriptionNumber: {value: ''},
alternateHostname: {value: ''},
name: {value: ''},
showStatusActivities: {value: false},
showErrors: {value: false},
allowAnonymous: {value: true, required: true},
allowAnonymous: {value: true},
individualCerts: {value: false},
isAuditing: {value: false},
serverDiscovery: {value: true},
users: { value: [] },
Expand Down Expand Up @@ -350,6 +351,32 @@
node.editorAddressSpaceScript.resize()
}

// Certificate Management
try {
let certsCheckbox = $("#node-config-input-individualCerts");
let configCertFields = $("#node-config-certFiles");

if (this.individualCerts) {
certsCheckbox.prop('checked', true);
configCertFields.show();
} else {
certsCheckbox.prop('checked', false);
configCertFields.hide();
}

certsCheckbox.change(function () {
if ($(this).is(":checked")) {
configCertFields.show();
} else {
configCertFields.hide();
$('#node-config-input-publicCertificateFile').val('');
$('#node-config-input-privateKeyFile').val('');
}
});

} catch (err) {
this.error(err);
}
},
oneditsave: function () {
let node = this
Expand Down Expand Up @@ -481,14 +508,25 @@
</label>
</div>
<div class="form-row">
<label for="node-input-publicCertificateFile"><i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.publicCertificateFile"></span></label>
<input type="text" id="node-input-publicCertificateFile" placeholder="./certificates/server_selfsigned_cert_2048.pem" style="min-width:480px">
<label style="min-width:240px">
<i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.individualCerts"></span>
<input type="checkbox" id="node-config-input-individualCerts" style="max-width:30px">
</label>
</div>
<div class="form-row">
<label for="node-input-privateCertificateFile"><i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.privateCertificateFile"></span></label>
<input type="text" id="node-input-privateCertificateFile" placeholder="./certificates/PKI/own/private/private_key.pem" style="min-width:480px">
<div id="node-config-certFiles">
<hr>
<div class="form-row">
<label for="node-input-publicCertificateFile"><i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.publicCertificateFile"></span></label>
<input type="text" id="node-input-publicCertificateFile" placeholder="./certificates/server_selfsigned_cert_2048.pem" style="min-width:480px">
</div>
<div class="form-row">
<label for="node-input-privateCertificateFile"><i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.privateCertificateFile"></span></label>
<input type="text" id="node-input-privateCertificateFile" placeholder="./certificates/PKI/own/private/private_key.pem" style="min-width:480px">
</div>
<hr>
</div>
<div class="form-row">
<label for="node-input-allowAnonymous" style="min-width:140px"><i class="icon-lock"></i>
Expand Down
57 changes: 48 additions & 9 deletions src/opcua-iiot-server.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
defaults: {
port: {value: '55388', required: true},
endpoint: {value: ''},
acceptExternalCommands: {value: true, required: true},
acceptExternalCommands: {value: true},
maxAllowedSessionNumber: {value: ''},
maxConnectionsPerEndpoint: {value: ''},
maxAllowedSubscriptionNumber: {value: ''},
Expand All @@ -23,7 +23,8 @@
showStatusActivities: {value: false},
showErrors: {value: false},
asoDemo: {value: true},
allowAnonymous: {value: true, required: true},
allowAnonymous: {value: true},
individualCerts: {value: false},
isAuditing: {value: false},
serverDiscovery: {value: true},
users: { value: [] },
Expand Down Expand Up @@ -310,6 +311,33 @@
$("#dialog").on("dialogclose", function (ev, ui) {
$("#dialog").off("dialogresize", switchDialogResize)
})

// Certificate Management
try {
let certsCheckbox = $("#node-config-input-individualCerts");
let configCertFields = $("#node-config-certFiles");

if (this.individualCerts) {
certsCheckbox.prop('checked', true);
configCertFields.show();
} else {
certsCheckbox.prop('checked', false);
configCertFields.hide();
}

certsCheckbox.change(function () {
if ($(this).is(":checked")) {
configCertFields.show();
} else {
configCertFields.hide();
$('#node-config-input-publicCertificateFile').val('');
$('#node-config-input-privateKeyFile').val('');
}
});

} catch (err) {
this.error(err);
}
},
oneditsave: function () {
let node = this
Expand Down Expand Up @@ -443,14 +471,25 @@
</label>
</div>
<div class="form-row">
<label for="node-input-publicCertificateFile"><i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.publicCertificateFile"></span></label>
<input type="text" id="node-input-publicCertificateFile" placeholder="./certificates/server_selfsigned_cert_2048.pem" style="min-width:480px">
<label style="min-width:240px">
<i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.individualCerts"></span>
<input type="checkbox" id="node-config-input-individualCerts" style="max-width:30px">
</label>
</div>
<div class="form-row">
<label for="node-input-privateCertificateFile"><i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.privateCertificateFile"></span></label>
<input type="text" id="node-input-privateCertificateFile" placeholder="./certificates/PKI/own/private/private_key.pem" style="min-width:480px">
<div id="node-config-certFiles">
<hr>
<div class="form-row">
<label for="node-input-publicCertificateFile"><i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.publicCertificateFile"></span></label>
<input type="text" id="node-input-publicCertificateFile" placeholder="./certificates/server_selfsigned_cert_2048.pem" style="min-width:480px">
</div>
<div class="form-row">
<label for="node-input-privateCertificateFile"><i class="fa fa-file"></i>
<span data-i18n="opcua-iiot-contrib.label.privateCertificateFile"></span></label>
<input type="text" id="node-input-privateCertificateFile" placeholder="./certificates/PKI/own/private/private_key.pem" style="min-width:480px">
</div>
<hr>
</div>
<div class="form-row">
<label for="node-input-allowAnonymous" style="min-width:140px"><i class="icon-lock"></i>
Expand Down

0 comments on commit 0f68a40

Please sign in to comment.