auth

package
v0.0.0-...-e24a7f5 Latest Latest
Warning

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

Go to latest
Published: May 3, 2017 License: LGPL-2.1 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationHeader

type AuthorizationHeader struct {
	URI      string
	Realm    string
	Nonce    string
	Username string
	Response string
}

AuthorizationHeader is a struct stored the infomation of parsing "Authorization:" line

func ParseAuthorizationHeader

func ParseAuthorizationHeader(buf string) *AuthorizationHeader

ParseAuthorizationHeader represents the parsing of "Authorization:" line, Authorization Header contains uri, realm, nonce, Username, response fields

type Database

type Database struct {
	Realm string
	// contains filtered or unexported fields
}

Database stores username and password to implement access control

func NewAuthDatabase

func NewAuthDatabase(realm string) *Database

NewAuthDatabase returns a pointer to a new instance of authorization database

func (*Database) InsertUserRecord

func (d *Database) InsertUserRecord(username, password string)

InsertUserRecord inserts user record, it contains username and password fields

func (*Database) LookupPassword

func (d *Database) LookupPassword(username string) (password string)

LookupPassword lookups the password by username

func (*Database) RemoveUserRecord

func (d *Database) RemoveUserRecord(username string)

RemoveUserRecord removes user record

type Digest

type Digest struct {
	Realm    string
	Nonce    string
	Username string
	Password string
}

Digest is a struct used for digest authentication. The "realm", and "nonce" fields are supplied by the server (in a "401 Unauthorized" response). The "username" and "password" fields are supplied by the client.

func NewDigest

func NewDigest() *Digest

NewDigest returns a pointer to a new instance of authorization digest

func (*Digest) ComputeResponse

func (d *Digest) ComputeResponse(cmd, url string) string

ComputeResponse represents generating the response using cmd and url value

func (*Digest) RandomNonce

func (d *Digest) RandomNonce()

RandomNonce randoms a nonce

Jump to

Keyboard shortcuts

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