lorenzodonini / ocpp-go

Open Charge Point Protocol implementation in Go
MIT License
277 stars 126 forks source link

feature to add a custom client validation handler before connected #170

Closed dwibudut closed 1 year ago

dwibudut commented 1 year ago

Feature to add a custom client validation handler before connected For example: used for validate the charging station id on database or API before connected upgraded(ws)

lorenzodonini commented 1 year ago

Hey there, thanks a lot for adding this. The use-case is definitely valid. I might take the liberty to slightly modify/move this logic at a later stage though.

The tests are currently failing because the MockWebsocketServer in the following files requires the new method signature as well:

dwibudut commented 1 year ago

Hello,

I just implement the requires method SetCheckClientHandler on the MockWebsocketServer and add test func to the method

This method can be used to validate the charging station id on database or API before connected upgraded(ws) or other, like validate request IP that allowed on the server, etc.

Thx

lorenzodonini commented 1 year ago

Great, thanks a lot for writing tests as well! Merged it