Skip to content

dowling-john/gin_django_auth

Repository files navigation

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"
    GINDJANGOAUTHSIGNINGKEY: "django-insecure-2z74-f1&^1xqaiw4!9^32^c*(9zr-zs1y5w2j9dlftb4@rz_f5"

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)
    

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages