Skip to content

amonaco/goauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goauth

Work-in-progress middleware module that can be used with Go-Chi as well as other frameworks.

Offers token and cookie-based authentication

It should be straight-forward to use on specific routes:

import (
        "net/http"

        "github.com/amonaco/goauth/lib/auth"
        "github.com/go-chi/chi"
)

func main() {

        r := chi.NewRouter()
        r.Use(middleware.Logger)

	resource := "/healthcheck" 
        r.Get(resource, func(w http.ResponseWriter, r *http.Request) {

                // Auth middleware here
                r.Use(auth.Middleware(resource))
                w.Write([]byte("OK"))
        })
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages