Simple Auth for api
I'm trying to connect our e-UP to EVCC using the http api. This fails, because I don't have a Drupal server installed. I only found AuhDrupal and AuthNone as modules for the the server. I don't want to install a Drupal instance for only one user, so I'm now trying to write a AuthSimple module for only one user with the username and password included in the code (I know, unsecure), so that the authentication for that user goes through and I get the variables I need for EVCC. Before I reinvent the wheel, does a code snippet perhaps exists, that does the trick? Regards Chris
OK, it was not that hard ... In the AuthNone.pm I changed the sub Authenticate to sub Authenticate { my ($user,$password) = @_; if ($user eq "xxx" && $password eq "yyy") { return '*'; } else { return ''; } } and activated AuthNone in the ovms_sever.conf Am Donnerstag, dem 13.03.2025 um 11:34 +0100 schrieb Chris van der Meijden via OvmsDev:
I'm trying to connect our e-UP to EVCC using the http api.
This fails, because I don't have a Drupal server installed. I only found AuhDrupal and AuthNone as modules for the the server.
I don't want to install a Drupal instance for only one user, so I'm now trying to write a AuthSimple module for only one user with the username and password included in the code (I know, unsecure), so that the authentication for that user goes through and I get the variables I need for EVCC.
Before I reinvent the wheel, does a code snippet perhaps exists, that does the trick?
Regards
Chris _______________________________________________ OvmsDev mailing list OvmsDev@lists.openvehicles.com http://lists.openvehicles.com/mailman/listinfo/ovmsdev
Chris, If you’d like to provide a simple contribution to the project it would be: AuthSimple.pm Use the Config::IniFiles config file we already have, with a new section to store the userid, password, etc. For users wanting to run their own server, but only having one user, that would be useful. Regards, Mark.
On 14 Mar 2025, at 12:38 AM, Chris van der Meijden via OvmsDev <ovmsdev@lists.openvehicles.com> wrote:
OK, it was not that hard ...
In the AuthNone.pm I changed the sub Authenticate to
sub Authenticate { my ($user,$password) = @_; if ($user eq "xxx" && $password eq "yyy") { return '*'; } else { return ''; } }
and activated AuthNone in the ovms_sever.conf
Am Donnerstag, dem 13.03.2025 um 11:34 +0100 schrieb Chris van der Meijden via OvmsDev:
I'm trying to connect our e-UP to EVCC using the http api.
This fails, because I don't have a Drupal server installed. I only found AuhDrupal and AuthNone as modules for the the server.
I don't want to install a Drupal instance for only one user, so I'm now trying to write a AuthSimple module for only one user with the username and password included in the code (I know, unsecure), so that the authentication for that user goes through and I get the variables I need for EVCC.
Before I reinvent the wheel, does a code snippet perhaps exists, that does the trick?
Regards
Chris _______________________________________________ OvmsDev mailing list OvmsDev@lists.openvehicles.com <mailto:OvmsDev@lists.openvehicles.com> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.openvehicles.com http://lists.openvehicles.com/mailman/listinfo/ovmsdev
Mark, sorry, for now I'm too busy with all the home automation stuff. I just needed a quick and dirty solution. If I would write the AuthSimple.pm as you suggested, I would need to find out how to access Config::IniFiles first and then would implement it not only for one user, but for, lets say, four users. For the case that there are several vehicles using OVMS in the family. Too time consuming at the moment for me. Allthough, if you are more familiar with the perl code, it should be fairly easy to achief, I think. Regards Chris Am Freitag, dem 14.03.2025 um 07:48 +0800 schrieb Mark Webb-Johnson:
Chris,
If you’d like to provide a simple contribution to the project it would be:
* AuthSimple.pm - Use the Config::IniFiles config file we already have, with a new section to store the userid, password, etc.
For users wanting to run their own server, but only having one user, that would be useful.
Regards, Mark.
On 14 Mar 2025, at 12:38 AM, Chris van der Meijden via OvmsDev <ovmsdev@lists.openvehicles.com> wrote:
OK, it was not that hard ...
In the AuthNone.pm I changed the sub Authenticate to
sub Authenticate { my ($user,$password) = @_; if ($user eq "xxx" && $password eq "yyy") { return '*'; } else { return ''; } }
and activated AuthNone in the ovms_sever.conf
Am Donnerstag, dem 13.03.2025 um 11:34 +0100 schrieb Chris van der Meijden via OvmsDev:
I'm trying to connect our e-UP to EVCC using the http api.
This fails, because I don't have a Drupal server installed. I only found AuhDrupal and AuthNone as modules for the the server.
I don't want to install a Drupal instance for only one user, so I'm now trying to write a AuthSimple module for only one user with the username and password included in the code (I know, unsecure), so that the authentication for that user goes through and I get the variables I need for EVCC.
Before I reinvent the wheel, does a code snippet perhaps exists, that does the trick?
Regards
Chris _______________________________________________ OvmsDev mailing list OvmsDev@lists.openvehicles.com http://lists.openvehicles.com/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.openvehicles.com http://lists.openvehicles.com/mailman/listinfo/ovmsdev
Hi, for people who like to manage cars and owners for a server V2 without Drupal: you find a bash script to manage the cars and owners directly in the database at https://github.com/zbchristian/ovms-server-docker.git (scripts/manage-db.sh) The script expects to find the configuration at the relative path "server/conf/ovms_server.conf" and extracts the DB user, DB password, DB host from it. Per default, the script stores the owner passwords in the DB as a Bcrypt hash. But its easy to change this to cleartext or another hashing method (function _pw_hash). The script can initialize the DB as well (see Readme). The script is part of my docker-compose setup for a minimal server V2 (only API V2, no Drupal, no HTTP API). Hope this helps. Regards Christian Am 14.03.2025 um 00:48 schrieb Mark Webb-Johnson via OvmsDev:
Chris,
If you’d like to provide a simple contribution to the project it would be:
* AuthSimple.pm o Use the Config::IniFiles config file we already have, with a new section to store the userid, password, etc.
For users wanting to run their own server, but only having one user, that would be useful.
Regards, Mark.
On 14 Mar 2025, at 12:38 AM, Chris van der Meijden via OvmsDev <ovmsdev@lists.openvehicles.com> wrote:
OK, it was not that hard ...
In the AuthNone.pm I changed the sub Authenticate to
sub Authenticate { my ($user,$password) = @_; if ($user eq "xxx" && $password eq "yyy") { return '*'; } else { return ''; } }
and activated AuthNone in the ovms_sever.conf
Am Donnerstag, dem 13.03.2025 um 11:34 +0100 schrieb Chris van der Meijden via OvmsDev:
I'm trying to connect our e-UP to EVCC using the http api.
This fails, because I don't have a Drupal server installed. I only found AuhDrupal and AuthNone as modules for the the server.
I don't want to install a Drupal instance for only one user, so I'm now trying to write a AuthSimple module for only one user with the username and password included in the code (I know, unsecure), so that the authentication for that user goes through and I get the variables I need for EVCC.
Before I reinvent the wheel, does a code snippet perhaps exists, that does the trick?
Regards
Chris _______________________________________________ OvmsDev mailing list OvmsDev@lists.openvehicles.com http://lists.openvehicles.com/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.openvehicles.com http://lists.openvehicles.com/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.openvehicles.com http://lists.openvehicles.com/mailman/listinfo/ovmsdev
participants (3)
-
Chris van der Meijden -
Info Zeitnitz -
Mark Webb-Johnson