Skip to content
/ auth Public

Package auth is a middleware that provides request authentication for Flamego

License

Notifications You must be signed in to change notification settings

flamego/auth

Folders and files

NameName
Last commit message
Last commit date
Jan 1, 2025
Dec 8, 2021
Aug 30, 2021
Dec 1, 2024
Aug 28, 2021
Oct 24, 2022
Mar 13, 2022
Aug 30, 2021
Mar 13, 2022
Mar 13, 2022
Dec 14, 2023
Mar 13, 2022
Aug 30, 2021
Jan 1, 2025
Jan 1, 2025

Repository files navigation

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.