Browse Source
Merge pull request #8380 from AndriiLandiak/feature/x509-device-provisioning
Fix/X509 device provisioning
pull/8383/head
Andrew Shvayka
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
5 additions and
2 deletions
-
dao/src/main/java/org/thingsboard/server/dao/device/DeviceProfileServiceImpl.java
-
ui-ngx/src/app/modules/home/components/profile/device-profile-provision-configuration.component.ts
|
|
|
@ -160,9 +160,12 @@ public class DeviceProfileServiceImpl extends AbstractCachedEntityService<Device |
|
|
|
handleEvictEvent(new DeviceProfileEvictEvent(deviceProfile.getTenantId(), deviceProfile.getName(), |
|
|
|
oldDeviceProfile != null ? oldDeviceProfile.getName() : null, null, deviceProfile.isDefault(), |
|
|
|
oldDeviceProfile != null ? oldDeviceProfile.getProvisionDeviceKey() : null)); |
|
|
|
String unqProvisionKeyErrorMsg = DeviceProfileProvisionType.X509_CERTIFICATE_CHAIN.equals(deviceProfile.getProvisionType()) |
|
|
|
? "Device profile with such certificate already exists!" |
|
|
|
: "Device profile with such provision device key already exists!"; |
|
|
|
checkConstraintViolation(t, |
|
|
|
Map.of("device_profile_name_unq_key", DEVICE_PROFILE_WITH_SUCH_NAME_ALREADY_EXISTS, |
|
|
|
"device_provision_key_unq_key", "Device profile with such provision device key already exists!", |
|
|
|
"device_provision_key_unq_key", unqProvisionKeyErrorMsg, |
|
|
|
"device_profile_external_id_unq_key", "Device profile with such external id already exists!")); |
|
|
|
throw t; |
|
|
|
} |
|
|
|
|
|
|
|
@ -107,7 +107,7 @@ export class DeviceProfileProvisionConfigurationComponent implements ControlValu |
|
|
|
} |
|
|
|
const certificateRegExPattern: string = this.provisionConfigurationFormGroup.get('certificateRegExPattern').value; |
|
|
|
if (!certificateRegExPattern || !certificateRegExPattern.length) { |
|
|
|
this.provisionConfigurationFormGroup.get('certificateRegExPattern').patchValue('[\\w]*', {emitEvent: false}); |
|
|
|
this.provisionConfigurationFormGroup.get('certificateRegExPattern').patchValue('(.*)', {emitEvent: false}); |
|
|
|
} |
|
|
|
const allowCreateNewDevicesByX509Certificate: boolean | null = this.provisionConfigurationFormGroup.get('allowCreateNewDevicesByX509Certificate').value; |
|
|
|
if (!isBoolean(allowCreateNewDevicesByX509Certificate)) { |
|
|
|
|