Search in sources :

Example 1 with LwM2MBootstrapClientCredential

use of org.thingsboard.server.common.data.device.credentials.lwm2m.LwM2MBootstrapClientCredential in project thingsboard by thingsboard.

the class DeviceCredentialsServiceImpl method validateLwM2MDeviceCredentials.

private void validateLwM2MDeviceCredentials(LwM2MDeviceCredentials lwM2MCredentials) {
    if (lwM2MCredentials == null) {
        throw new DeviceCredentialsValidationException("LwM2M credentials must be specified!");
    }
    LwM2MClientCredential clientCredentials = lwM2MCredentials.getClient();
    if (clientCredentials == null) {
        throw new DeviceCredentialsValidationException("LwM2M client credentials must be specified!");
    }
    validateLwM2MClientCredentials(clientCredentials);
    LwM2MBootstrapClientCredentials bootstrapCredentials = lwM2MCredentials.getBootstrap();
    if (bootstrapCredentials == null) {
        throw new DeviceCredentialsValidationException("LwM2M bootstrap credentials must be specified!");
    }
    LwM2MBootstrapClientCredential bootstrapServerCredentials = bootstrapCredentials.getBootstrapServer();
    if (bootstrapServerCredentials == null) {
        throw new DeviceCredentialsValidationException("LwM2M bootstrap server credentials must be specified!");
    }
    validateServerCredentials(bootstrapServerCredentials, "Bootstrap server");
    LwM2MBootstrapClientCredential lwm2MBootstrapClientCredential = bootstrapCredentials.getLwm2mServer();
    if (lwm2MBootstrapClientCredential == null) {
        throw new DeviceCredentialsValidationException("LwM2M lwm2m server credentials must be specified!");
    }
    validateServerCredentials(lwm2MBootstrapClientCredential, "LwM2M server");
}
Also used : LwM2MClientCredential(org.thingsboard.server.common.data.device.credentials.lwm2m.LwM2MClientCredential) LwM2MBootstrapClientCredential(org.thingsboard.server.common.data.device.credentials.lwm2m.LwM2MBootstrapClientCredential) DeviceCredentialsValidationException(org.thingsboard.server.dao.exception.DeviceCredentialsValidationException) LwM2MBootstrapClientCredentials(org.thingsboard.server.common.data.device.credentials.lwm2m.LwM2MBootstrapClientCredentials)

Aggregations

LwM2MBootstrapClientCredential (org.thingsboard.server.common.data.device.credentials.lwm2m.LwM2MBootstrapClientCredential)1 LwM2MBootstrapClientCredentials (org.thingsboard.server.common.data.device.credentials.lwm2m.LwM2MBootstrapClientCredentials)1 LwM2MClientCredential (org.thingsboard.server.common.data.device.credentials.lwm2m.LwM2MClientCredential)1 DeviceCredentialsValidationException (org.thingsboard.server.dao.exception.DeviceCredentialsValidationException)1