auth

GitHub Workflow Status Codecov GoDoc Sourcegraph

Package auth is a middleware that provides request authentication for Flamego.

Installation

The minimum requirement of Go is 1.16.

  1. go get github.com/flamego/auth

Getting started

  1. package main
  2. import (
  3. "github.com/flamego/auth"
  4. "github.com/flamego/flamego"
  5. )
  6. func main() {
  7. f := flamego.Classic()
  8. f.Use(auth.Basic("username", "secretpassword"))
  9. f.Get("/", func(user auth.User) string {
  10. return "Welcome, " + string(user)
  11. })
  12. f.Run()
  13. }

Getting help

License

This project is under the MIT License. See the LICENSE file for the full license text.