Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaidevd/flask-client-auth
https://github.com/jaidevd/flask-client-auth
Last synced: 23 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jaidevd/flask-client-auth
- Owner: jaidevd
- License: mit
- Created: 2024-11-19T14:18:35.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-19T15:11:53.000Z (about 1 month ago)
- Last Synced: 2024-11-19T16:26:39.073Z (about 1 month ago)
- Language: Python
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flask-client-auth
## Installation requirements
Please run the following command to install dependencies:
```bash
pip install flask requests bcrypt
```## Usage
There are two parts of interest in this project, the server and the client,
both available as Python modules.### Server
The server script is fundamentally a CLI, and can do one of the following at a
time:* Run a flask server (default)
* Add a user
* Update a user's password
* Delete a userPlease run the following command for more details:
```bash
$ python server.py -h
```E.g. to add users, run the following command:
```bash
$ python server.py add_user
```and to run the server, run the following command:
```bash
$ python server.py
```### Client
The client script reads the username and password from STDIN, sends a request to
a URL specified through a command line argument, and prints the response.E.g. to send a request with a username `user` and password `pass` to a url
(which could be `http://localhost:5000/check` while developing this app),
run the following command:```bash
echo "user\npass" | python client.py http://localhost:5000/check
```This prints the response if the server is running at the specified URL.
**Note:** The username and password have to be read through STDIN, separated by a newline.
## Testing
Run tests for the backend with the following command:
```bash
$ python tests.py
```---
#### Assignment Requirements (for my reference)
* A client and a server script.
* Authentication through a header named `SEEK_CUSTOM_AUTH`, the header contains:
- a username
- a password
- a unique machine ID which is not transferrable between computers
* The first time a client sends a request, the server associates the machine ID
with the user. No other user should then be able to use this machine ID.
* Server has only a `/check` endpoint.
* Auth is successful only if:
- The username and password are correct and a new machine ID is sent, or
- an existing machine ID is sent with the correct username and password.
* The client accepts a username and password from STDIN, sends the request and
prints the response.
* Backend should have a CLI to to add users and add or update passwords.
* Automated tests