/auth

Package auth is a middleware that provides request authentication for Flamego

Primary LanguageGoMIT LicenseMIT

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.18.

go get github.com/flamego/auth

Getting started

package main

import (
	"github.com/flamego/auth"
	"github.com/flamego/flamego"
)

func main() {
	f := flamego.Classic()
	f.Use(auth.Basic("username", "secretpassword"))
	f.Get("/", func(user auth.User) string {
		return "Welcome, " + string(user)
	})
	f.Run()
}

Getting help

License

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