Check OCPI auth ID in authorize
MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -490,7 +490,9 @@ export default class OCPPService {
const user = await Authorizations.isAuthorizedOnChargingStation(headers.tenantID, chargingStation,
authorize.idTag, ServerAction.AUTHORIZE, Action.AUTHORIZE);
// Roaming User
- if (user && !user.issuer && user.authorizationID) {
+ if (user && !user.issuer) {
+ // Authorization ID provided?
+ if (user.authorizationID) {
// Public Charging Station
if (chargingStation.public) {
// Keep Romaing Auth ID
@@ -501,7 +503,18 @@ export default class OCPPService {
action: ServerAction.AUTHORIZE,
module: MODULE_NAME,
method: 'handleAuthorize',
- message: 'Cannot authorize a roaming user on a private charging station'
+ message: 'Cannot authorize a roaming user on a private charging station',
+ detailedMessages: { authorize }
+ });
+ }
+ } else {
+ throw new BackendError({
+ user: user,
+ action: ServerAction.AUTHORIZE,
+ module: MODULE_NAME,
+ method: 'handleAuthorize',
+ message: 'Authorization ID has not been supplied',
+ detailedMessages: { authorize }
});
}
}
@@ -515,7 +528,8 @@ export default class OCPPService {
source: chargingStation.id,
module: MODULE_NAME, method: 'handleAuthorize',
action: ServerAction.AUTHORIZE, user: (authorize.user ? authorize.user : null),
- message: `User has been authorized with Badge ID '${authorize.idTag}'`
+ message: `User has been authorized with Badge ID '${authorize.idTag}'`,
+ detailedMessages: { authorize }
});
// Return
return {

MODIFY
src/utils/Logging.ts
src/utils/Logging.ts
@@ -981,9 +981,8 @@ export default class Logging {
await Logging.logDebug({
tenantID: tenantID,
source: chargeBoxID,
- module: module, method: action,
+ module: module, method: action, action,
message: `${direction} OCPP Request '${action}' ${direction === '>>' ? 'received' : 'sent'}`,
- action: ServerAction.PERFORMANCES,
detailedMessages: { args }
});
}
@@ -1022,16 +1021,14 @@ export default class Logging {
await Logging.logError({
tenantID,
source: chargeBoxID,
- module, method: action,
- action: ServerAction.PERFORMANCES,
+ module, method: action, action,
message, detailedMessages
});
} else {
await Logging.logDebug({
tenantID,
source: chargeBoxID,
- module, method: action,
- action: ServerAction.PERFORMANCES,
+ module, method: action, action,
message, detailedMessages
});
}

Check OCPI auth ID in authorize