Commit Graph

54 Commits (45b5bc3d2d7f32011c80dd3e07106e4b666da70a)

Author SHA1 Message Date
absc 45b5bc3d2d Corrected documentation string. 2024-08-15 22:44:45 +00:00
absc 18a430614f Use proplists instead of lists. 2024-08-15 22:39:22 +00:00
absc e95e91b645 The defines file is not needed here. 2024-08-15 22:15:57 +00:00
absc ae07951cd2 Add the authentication handler to the routes. 2024-08-15 22:11:19 +00:00
absc 1ca3e1f4ef No need to mention the cookies. 2024-08-15 22:08:46 +00:00
absc eb58109292 Add the macros file. 2024-08-15 22:03:30 +00:00
absc 861f3e0258 Use macros for the cookie names. 2024-08-15 22:02:57 +00:00
absc 812b182499 Abstract updating user informations. 2024-08-15 21:59:35 +00:00
absc bbb44f9337 Make reading the registration data a more abstract operation. 2024-08-15 21:54:41 +00:00
absc b3cdc8ee45 Abstract reading the login data from the request. 2024-08-15 21:45:36 +00:00
absc f9d3c5fa4b Make indentation consistent. 2024-08-15 21:26:22 +00:00
absc a3f041cff7 Remove not needed newline. 2024-08-15 21:22:54 +00:00
absc 38d8e29734 Abstract setting the cookie for the client request. 2024-08-15 21:20:38 +00:00
absc c9fcd47064 Abstract cookies invalidation. 2024-08-15 21:12:07 +00:00
absc a18fa4989c Use the auth_cookie function to extract cookies. 2024-08-15 21:02:41 +00:00
absc dac21c4537 Abstract cookie handling. 2024-08-15 21:00:06 +00:00
absc a0cbc962d1 Corrected call to authenticate. 2024-08-15 20:41:30 +00:00
absc 29cb046e3d Corrected authenticate function calls. 2024-08-15 20:37:08 +00:00
absc 73d98ed56f Move the defines in their own file.
At the same time, simplify a bunch of APIs.
2024-08-15 20:27:02 +00:00
absc e7e34d78d6 We plan to use this with a reverse proxy. The plan may change in the future. 2024-08-12 21:01:16 +00:00
absc e8ccc3a29f Keep it simple for now. We want to write a proper test suite for this and
letting it crash is more than good enough.

It was a mistake to try to add more complications to the APIs at this point
in time.
2024-08-12 21:00:26 +00:00
absc 2ad3b52c06 Corrected syntax error. 2024-08-12 20:41:24 +00:00
absc 640ffe4d75 Corrected stuffs found through the dialyzer. 2024-08-11 20:56:11 +00:00
absc 2b530fbe7e Added some more detailed responses to the JSON API calls. 2024-08-11 20:49:48 +00:00
absc 2d0d384d1e Add the JSON body to the user API responses. 2024-08-09 22:35:53 +00:00
absc dcc7bc3ca3 Introduce the authentication handler.
The user handler will also receive the ability to answer with
JSON bodies soon.
2024-08-09 22:19:17 +00:00
absc 51675065a9 Pass the user for authentication with cookies in a cookie itself. 2024-08-09 20:37:47 +00:00
absc 6acd5e3a5a Move the cookie parameter as value. 2024-08-09 19:50:19 +00:00
absc 318ab0d301 Corrected module documentation. 2024-08-07 22:19:11 +00:00
absc ceea61c1ed Add the username to the JSON response to GET.
In addition to this, version the API with the classic
"api/v1" path.
2024-08-07 22:10:45 +00:00
absc df09a192b0 Updated function documentation specification. 2024-08-07 20:26:38 +00:00
absc 3b9693e276 Properly set the cookie validity, and return it to the
caller along with the cookie itself.
2024-08-07 20:22:45 +00:00
absc 9bf0e3609a Replace hard-coded value with the macro. 2024-08-07 01:23:30 +02:00
absc b06e7d9f50 Complete the registration API.
After some fight to decide on the right design, we finally have
a module to handle users details.

The API is JSON-based and it's documented on the top of the
dudeswave_handler.erl file.

The dudeswave_auth module, implements the functions that handle
things at the storage layer, as we would like to reuse those
capabilties in the future.

To add, the "delete" call doesn't handle removing the cookies for
the moment, It'll come with the next commit.

Additionally, after that, a related test suite will be added, in
order to start to test the whole thing locally.
2024-08-07 01:17:35 +02:00
absc 2b995f67c8 After some internal (with myself) debate, we will go with JSON.
It just makes much more sense, to build a decent and modern
platform.
2024-08-04 13:54:46 +02:00
absc 96781451b0 Improve the registration bit.
Now, we return a proper answer when creating a user through a
POST request.

Maybe in the future we will convert the APIs to use JSON, like
all cool kids do. However, it doesn't look like it makes much
sense in this case.
2024-08-03 01:13:47 +02:00
absc fa66ec399d We only allow POST for the registration form. 2024-08-02 23:46:24 +02:00
absc 2470af1296 Give a better name to the registration handler. 2024-08-02 23:43:03 +02:00
absc 631f729ed9 No, JSON is not needed here.
For this simple blogging platform, let's start simple, basic
HTML forms are enough.
2024-08-02 23:40:55 +02:00
absc 33cc07914d Complete the GET handler. It would return some wrong codes before. 2024-08-02 23:24:54 +02:00
absc f1ad05f789 Make the ip address type configurable.
We want to be able to use both IPv4 and IPv6.
2024-08-02 23:15:28 +02:00
absc dbf5371122 The routes were in the wrong format. Correct them. 2024-08-02 23:12:33 +02:00
absc 94ee24c777 Add the right arguments to the bootstrap procedure. 2024-08-02 22:56:03 +02:00
absc c6328bd174 The bootstrap procedure must be done before the first start.
The bootstrap will create the various tables, the admin user,
and the initial content of the platform, with the possibility
to add replication for everything.
2024-08-02 22:53:04 +02:00
absc e571a69820 Use crypto:rand_seed().
It's cryptographically strong and set a better state for the
pseudo-random number generator.
2024-07-27 13:16:05 +02:00
absc ab3ca1ec64 No need to use an additional variable just to compose the salted pass. 2024-07-27 12:38:30 +02:00
absc 80af46c6be Just use the classic POST form.
JSON doesn't make any sense in this case.
2024-07-27 12:36:14 +02:00
absc 895e0a5330 Enter the user handler API.
For now it handles PUTs, to create new users. It's still a
partial implementation and there is no documentation yet.

POST, PATCH and DELETE will arrive later to handle other users
operations.
2024-07-27 01:57:34 +02:00
absc 285f4ad402 Correct the callback matching for the ProvidedCallback function. 2024-07-25 01:18:00 +02:00
absc 8f7481d785 Use the REST handler instead of the default one.
This makes the code simpler and more manageable.
2024-07-24 23:32:16 +02:00