gorden

package module
v0.0.0-...-d5eaf87 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2013 License: MIT Imports: 2 Imported by: 2

README

gorden

WIP authentication for web applications

Sample Setup

import "github.com/qwait/gorden"

gorden.AddStrategy("password", PasswordStrategy{})}

type PasswordStrategy struct {}

func (PasswordStrategy) Authenticate(arguments interface{}) bool {
    return false
}

func (PasswordStrategy) IsAuthenticated() bool {
    return false
}

gorden.NewManager("password", gorden.SessionConfig{CookieName: "auth_token", CookieKey: []byte("so secret")})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddStrategy

func AddStrategy(name string, strategy Strategy)

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(strategyName string, sessionConfig SessionConfig) *Manager

func (*Manager) Authenticate

func (manager *Manager) Authenticate(arguments interface{}) bool

func (*Manager) GetUser

func (manager *Manager) GetUser(r *http.Request) interface{}

func (*Manager) IsAuthenticated

func (manager *Manager) IsAuthenticated() bool

func (*Manager) SetUser

func (manager *Manager) SetUser(r *http.Request, w http.ResponseWriter, user_id int)

type SessionConfig

type SessionConfig struct {
	CookieName string
	CookieKey  []byte
	Path       string
	Domain     string
	MaxAge     int
	Secure     bool
	HttpOnly   bool
}

type Strategy

type Strategy interface {
	Authenticate(arguments interface{}) bool
	IsAuthenticated() bool
}

Jump to

Keyboard shortcuts

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