-
Notifications
You must be signed in to change notification settings - Fork 0
Project Documentation
jalaz@jalaz-personal:~/Documents/Github$ tree Auth-API/
Auth-API/
├── helper-guide.md
├── LICENSE
├── Procfile
├── README.md
├── requirements.txt
└── service
├── api
│ ├── auth.db
│ ├── auth.py
│ ├── __init__.py
│ ├── log.conf
│ ├── log.py
│ ├── models.py
│ ├── oauth.py
│ ├── routes_auth.py
│ └── routes_oauth.py
├── api.env
├── app.py
├── config.py
├── logs
│ └── app.log
├── run-tests.sh
├── start.sh
└── tests
├── __init__.py
├── test_base.py
├── test_oauth.py
├── test_resource_access.py
├── test_token_creation.py
├── test_user_access.py
└── test_user_signup.py
4 directories, 27 files
-
service/start.sh : Bash file for loading env variables, initializing virtualenv, starting flask server & running the API
-
service/run-tests.sh : Bash file for running unit tests
-
service/api.env : ENV Configuration file for loading dev, stg & test properties, not a part of git repo. Requires to be added during project build.
-
service/app.py Main file which runs the flask server & exposes the API.
-
service/config.py : Main Configuration file which loads env variables related to dev, stage, prod, testing & OAuth services for the python services in the form of classes.
-
helper-guide.md : File which contains instructions to build & run the API on local machine & deploy to production servers.
-
Procfile : File for explicitly declaring what command should be executed to start your app, required for Heroku deployment.
-
requirements.txt : File used for specifying what python packages are required to run the API
-
api/auth.db : In-memory DB file of SQLite required for the dev environment. Not on git path, is created locally.
-
api/log.conf : Configuration file for centralized logging of API logs.
-
init.py : Main python file which loads DB based on SQLAlchemy & env configurations, creates a flask app, loads all routes & return the main authapp object which is imported from app.py
-
models.py : Contains a model class
User
having- data members as id, name, email, password_hash
- hash_password() : Hashes the password provided as argument
- verify_password() : Verifies the stored password_hash with the computed hash of provided password as argument
- generate_auth_token() : Creates an token with a fixed expiry time & dumps it in memory for matching
- verify_auth_token(): Verifies if the token passed as argument is stored in-memory & if it does, returns the data associated with it.
-
auth.py : Initiases an HTTPBasicAuth() object & passes over.
-
oauth.py :
- OAuthSignIn
- init() : Constructor, loads providers & their configurations
- authorize() : Abstract Methods
- callback() : Abstract Methods
- get_callback_url()
- load_provider() : Class Method
- get_provider() : Class Method
- FacebookSignIn
- Inherits from OAuthSignIn
- TwitterSignIn
- Inherits from OAuthSignIn
- GithubSignIn
- Inherits from OAuthSignIn
- GoogleSignIn
- Inherits from OAuthSignIn
- LinkedInSignIn
- Inherits from OAuthSignIn
- OAuthSignIn
-
routes_auth.py
- intro() : Serves GET:
/api/
- register_user() : Serves POST:
/api/users/
- get_user(): Serves GET:
/api/users/<int:id>
- get_auth_token(): Serves GET:
/api/token
- get_resource(): Serves GET:
api/resource
- intro() : Serves GET:
-
routes_oauth.py
-
log.py
-
test_base.py
-
test_oauth.py
-
test_resource_access.py
-
test_token_creation.py
-
test_user_access.py
-
test_user_signup.py
Made with ❤️ by Jalaz Kumar