Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Simple Web Form Submission and JWT Auth

This example implements web form submission Go. This is a login application where the user signs in with his/her username and password. Once a user is authenticated, the application will persist the session using JWT.

This application has the following functions:

  1. Reads a file from the filesystem and streams the static file content to the web as a web form for the user to log in.
  2. Handles the submitted form.
  3. Persists a JWT in a cookie when the user is authenticated successfully.
  4. Redirects the user to another static web page called welcome page, which is only accessible to authorized users. The application examines if a valid JWT is in the request.
  5. Disables browser caching on the welcome page.

Setup

  1. Run the server

    $ make run
  2. Launch a web browser and navigate to http://localhost:8000.