message: Check that the Token ID is well formed
diff: @@ -63,33 +63,36 @@ export default class OCPPUtils {
  if (!tokenID) {
  throw new BackendError({
  chargingStationID: chargingStationID,
  - action: ServerAction.OCPP_BOOT_NOTIFICATION,
  - module: MODULE_NAME, method: 'ensureChargingStationHasValidConnectionToken',
  + action, module: MODULE_NAME, method: 'ensureChargingStationHasValidConnectionToken',
  message: 'Token ID is required, request rejected!',
  });
  }
  + if (!DatabaseUtils.isObjectID(tokenID)) {
  + throw new BackendError({
  + action, chargingStationID,
  + module: MODULE_NAME, method: 'ensureChargingStationHasValidConnectionToken',
  + message: `The Token ID '${tokenID}' is invalid, request rejected!`
  + });
  + }
  // Get the Token
  const token = await RegistrationTokenStorage.getRegistrationToken(tenant, tokenID);
  if (!token) {
  throw new BackendError({
  chargingStationID: chargingStationID,
  - action,
  - module: MODULE_NAME, method: 'ensureChargingStationHasValidConnectionToken',
  + action, module: MODULE_NAME, method: 'ensureChargingStationHasValidConnectionToken',
  message: `Token ID '${tokenID}' has not been found, request rejected!`,
  });
  }
  if (!token.expirationDate || moment().isAfter(token.expirationDate)) {
  throw new BackendError({
  chargingStationID: chargingStationID,
  - action,
  - module: MODULE_NAME, method: 'ensureChargingStationHasValidConnectionToken',
  + action, module: MODULE_NAME, method: 'ensureChargingStationHasValidConnectionToken',
  message: `Token ID '${tokenID}' has expired, request rejected!`,
  });
  }
  if (token.revocationDate && moment().isAfter(token.revocationDate)) {
  throw new BackendError({
  - action,
  - module: MODULE_NAME, method: 'ensureChargingStationHasValidConnectionToken',
  + action, module: MODULE_NAME, method: 'ensureChargingStationHasValidConnectionToken',
  message: `Token ID '${tokenID}' has been revoked, request rejected!`,
  });
  }
  