Giter VIP home page Giter VIP logo

jwt-project's Introduction

JWT Project

Project for ITMI 7.2 - Digital Security: Networking and Encryption

This repo. contains a python flask implementation of jwt based authentication scheme. The app is backend only and can be tested using postman.

More about jwt at http://jwt.io

###Setup Database

  1. Create a file called main.db in the root directory.
  2. Open a python shell and run the following commands:
>>> from models import *
>>> models.create_tables()

If you are cloning this repo, you can skip this step as it already has a database set

Registration

  1. Run the flask app - $ python app.py
  2. Open Postman and send a post request to http://localhost:5000/register with the following params
    • username
    • password
  3. The app will create a new record in db or throw an error.

Authenticate

  1. Send a post request to http://localhost:5000 with username and password (the account for which you want to login)
  2. The app will send a token if authentication was successful and error otherwise.

Secure Route

Try to open http://localhost:5000/secure in your browser (or send a get with postman). You should get a 400 not allowed error. This is because this route is expecting a token and is available only to authorized users.

Now send a get to http://localhost:5000/secure?token=eeee..., the token is the one you received in Authenticate step. It the token is valid, then you'll see a You have arrived message.

Insecure Route

This is an open route and returns a Welcome ! message, with our without token.

jwt-project's People

Contributors

shivekkhurana avatar

Stargazers

Himanshu Saini avatar

Watchers

James Cloos avatar Himanshu Saini avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.