gin_django_auth

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2023 License: Apache-2.0

README

Gin-Gonic Django Authentication Handler

Unit Tests coverage

If you have a django backend/admin portal this module allows for the connection of you application to the django backend authentication and authorisation system.

We use the sessionid cookie from the django sessions table to authenticate/authorise request coming into the gin router.

Features

  • Secure Gin routes with a Django session cookie
  • Adding login handler to create session on the django server
  • Support for multiple flavours of sql database

Installation

    go get github.com/dowling-john/gin_django_auth

Required environment variables

    GINDJANGOAUTHDBCONNECTIONSTRING : "postgres://<username>:<password>@<host>:5432/<db>?sslmode=disable"
    GINDJANGOAUTHDBDIALECT: "postgres"

Login Required Usage

    import (
	    "github.com/Flexin1981/gin_django_auth/middleware"
    )

    router.POST("/graphql", middleware.LoginRequired, handlers.GraphQlHandler)
    

Handler Usage

    import (
	    "github.com/Flexin1981/gin_django_auth/handlers"
    )

    router.POST("/login", handlers.DjangoLoginHandler)
    

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL