auth: github.com/go-macaron/auth Index | Files | Directories

package auth

import "github.com/go-macaron/auth"

Index

Package Files

basic.go bearer.go util.go

Variables

var BasicRealm = "Authorization Required"

BasicRealm is used when setting the WWW-Authenticate response header.

func Basic Uses

func Basic(username string, password string) macaron.Handler

Basic returns a Handler that authenticates via Basic Auth. Writes a http.StatusUnauthorized if authentication fails.

func BasicFunc Uses

func BasicFunc(authfn func(string, string) bool) macaron.Handler

BasicFunc returns a Handler that authenticates via Basic Auth using the provided function. The function should return true for a valid username/password combination.

func Bearer Uses

func Bearer(token string) macaron.Handler

Bearer returns a Handler that authenticates via Bearer Auth. Writes a http.StatusUnauthorized if authentication fails.

func BearerFunc Uses

func BearerFunc(authfn func(string) bool) macaron.Handler

BearerFunc returns a Handler that authenticates via Bearer Auth using the provided function. The function should return true for a valid bearer token.

func SecureCompare Uses

func SecureCompare(given string, actual string) bool

SecureCompare performs a constant time compare of two strings to limit timing attacks.

type User Uses

type User string

User is the authenticated username that was extracted from the request.

Directories

PathSynopsis
example

Package auth imports 6 packages (graph) and is imported by 6 packages. Updated 2016-12-31. Refresh now. Tools for package owners.