auth

package module
v0.0.0-...-406cfb6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2015 License: MIT Imports: 10 Imported by: 0

README

negroni-auth Build Status

Negroni middleware/handler for http basic authentication forked from martini-contrib/auth.

API Reference

Usage

import (
  "github.com/codegangsta/negroni"
  "github.com/nabeken/negroni-auth"
)

func main() {
  m := negroni.New()
  // authenticate every request
  m.UseHandler(auth.Basic("username", "secretpassword"))
  m.Run()
}

Authors

Documentation

Overview

Package auth implements Basic authentication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Basic

func Basic(userid, password string) negroni.HandlerFunc

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

func CacheBasic

func CacheBasic(datastore datastore.Datastore, cacheExpireTime, cachePurseTime time.Duration) negroni.HandlerFunc

CacheBasic returns a negroni.HandlerFunc that authenticates via Basic auth using cache. Writes a http.StatusUnauthorized if authentication fails.

func CacheBasicDefault

func CacheBasicDefault(datastore datastore.Datastore) negroni.HandlerFunc

CacheBasicDefault returns a negroni.HandlerFunc that authenticates via Basic auth using cache. with default cache configuration. Writes a http.StatusUnauthorized if authentication fails.

func Hash

func Hash(password string) ([]byte, error)

Hash returns a hashed password.

func NewBasic

func NewBasic(datastore datastore.Datastore) negroni.HandlerFunc

NewBasic returns a negroni.HandlerFunc that authenticates via Basic auth using data store. Writes a http.StatusUnauthorized if authentication fails.

func NewSimpleBasic

func NewSimpleBasic(userId, password string) (*datastore.Simple, error)

NewSimpleBasic returns *datastore.Simple built from userid, password.

func SecureCompare

func SecureCompare(given string, actual string) bool

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

Types

This section is empty.

Directories

Path Synopsis
Package datastore implements datastore (key, value pair) interface.
Package datastore implements datastore (key, value pair) interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL