ticket

package
v4.0.14+incompatible Latest Latest
Warning

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

Go to latest
Published: May 28, 2015 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package ticket generates and verifies authentication tickets

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExpired   = errors.New("expired")
	ErrInvalidIP = errors.New("invalid IP")
)

Functions

func Grant

func Grant(user, ip string, validity int64) string

Grant generates a ticket for the given user, IP and validity stamp.

func Init

func Init()

Init (re)initializes the session that tickets are based on. Init is called automatically on package initialization but may be called manually to invalidate all currently granted tickets.

func LoadKey

func LoadKey(r io.Reader)

LoadKey initializes the session key that tickets are based on from the Reader.

func Verify

func Verify(tic, ip string, validity int64) (string, error)

Verify checks that a ticket is valid for the given IP and validity time, and returns the authenticated user name or an error.

Types

type Ticket

type Ticket struct {
	Nonce    []byte
	User     string
	IP       []string
	Validity int64
}

func Load

func Load(tic string) (*Ticket, error)

func (Ticket) String

func (t Ticket) String() string

Jump to

Keyboard shortcuts

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