The Wayback Machine - https://web.archive.org/web/20221117105931/https://github.com/flamego/auth
Skip to content

flamego/auth

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.