security

package module
v0.0.0-...-4edce37 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2015 License: MIT Imports: 19 Imported by: 0

README

Security

Build Status GoDoc Coverage Status license

A security extension for the Go language based Flotilla web framework.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigurationError = SecurityError(`configuration error: %s`).Out
View Source
var InvalidEmail = SecurityError(`Invalid email address: %s`).Out
View Source
var InvalidSignedField = SecurityError("Invalid signed field: %s").Out
View Source
var PasswordMismatch = SecurityError("Provided passwords do not match")

Functions

func AnonymousRequired

func AnonymousRequired(h flotilla.Manage) flotilla.Manage

func CheckPasswords

func CheckPasswords(f Form) (bool, error)

func CheckUserPassword

func CheckUserPassword(f Form) (bool, error)

func LoginRequired

func LoginRequired(h flotilla.Manage) flotilla.Manage

func MsgError

func MsgError(s *Manager, ms string) error

func NewUserName

func NewUserName(s *Manager, name string, options ...string) fork.Field

func Next

func Next(s *Manager, name string, options ...string) fork.Field

func PassWord

func PassWord(name string, options ...string) fork.Field

func SecurityError

func SecurityError(errf string) *securityError

func SecurityRoute

func SecurityRoute(b *flotilla.Blueprint, name string, method string, path string, m ...flotilla.Manage)

func Signed

func Signed(name string, s token.Signatory, options ...string) fork.Field

func Unauthenticated

func Unauthenticated(f flotilla.Ctx, s *Manager)

func UserName

func UserName(s *Manager, name string, options ...string) fork.Field

func ValidEmail

func ValidEmail(u *userName) error

func ValidateSigned

func ValidateSigned(s *signed) error

Types

type Configuration

type Configuration func(*Manager) error

func WithEmailer

func WithEmailer(e Emailer) Configuration

func WithSettings

func WithSettings(items ...string) Configuration

func WithUserDataStore

func WithUserDataStore(u user.DataStore) Configuration

type EmailData

type EmailData map[string]interface{}

type EmailTemplates

type EmailTemplates map[string]*template.Template

type Emailer

type Emailer interface {
	smtp.Auth
	Render(string, map[string]interface{}) (*bytes.Buffer, error)
	Send(string, []byte) error
}

func NewEmailer

func NewEmailer(m *Manager, templates map[string]string) Emailer

type Form

type Form interface {
	Fresh(...interface{}) Form
	fork.Form
}

func ChangePasswordForm

func ChangePasswordForm(s *Manager) Form

func ConfirmUserForm

func ConfirmUserForm(s *Manager) Form

func LoginForm

func LoginForm(s *Manager) Form

func PasswordlessForm

func PasswordlessForm(s *Manager) Form

func RegisterForm

func RegisterForm(s *Manager) Form

func ResetPasswordForm

func ResetPasswordForm(s *Manager) Form

func SendConfirmForm

func SendConfirmForm(s *Manager) Form

func SendResetForm

func SendResetForm(s *Manager) Form

type Forms

type Forms map[string]Form

type IfValid

type IfValid func(flotilla.Ctx, *Manager, Form)

type Manager

type Manager struct {
	user.DataStore
	App *flotilla.App

	Settings
	Urls
	Times
	Forms
	Messages
	Signatories
	Emailer
	// contains filtered or unexported fields
}

func New

func New(c ...Configuration) *Manager

func (*Manager) BoolSetting

func (s *Manager) BoolSetting(key string) bool

func (*Manager) Configuration

func (m *Manager) Configuration(conf ...Configuration) error

func (*Manager) CurrentUser

func (s *Manager) CurrentUser() user.User

func (*Manager) DefaultSignatory

func (s *Manager) DefaultSignatory() token.Signatory

func (*Manager) Flash

func (s *Manager) Flash(f flotilla.Ctx, messages ...string)

func (*Manager) FmtSetting

func (s *Manager) FmtSetting(base, key string) string

func (*Manager) Init

func (s *Manager) Init(a *flotilla.App)

func (*Manager) LoginUser

func (s *Manager) LoginUser(u user.User, remember bool, f flotilla.Ctx)

func (*Manager) LogoutUser

func (s *Manager) LogoutUser(f flotilla.Ctx)

func (*Manager) ManagerLogin

func (s *Manager) ManagerLogin() string

func (*Manager) Message

func (s *Manager) Message(ms string) Message

func (*Manager) NewForm

func (m *Manager) NewForm(tag string, c []interface{}, fields ...fork.Field) Form

func (*Manager) NewUrls

func (s *Manager) NewUrls() Urls

func (*Manager) Passwordless

func (s *Manager) Passwordless() bool

func (*Manager) SendMail

func (s *Manager) SendMail(template string, to string, link string) error

func (*Manager) Setting

func (s *Manager) Setting(key string) string

func (*Manager) Signatory

func (s *Manager) Signatory(key string) token.Signatory

func (*Manager) Token

func (s *Manager) Token(from string, claims ...string) string

func (*Manager) ValidUserName

func (s *Manager) ValidUserName(u *userName) error

type Message

type Message interface {
	Category() string
	String() string
	Error() error
}

func Msg

func Msg(text string, label string) Message

type Messages

type Messages map[string]Message

type Settings

type Settings map[string]string

type Signatories

type Signatories map[string]token.Signatory

type Times

type Times interface {
	Duration(string) time.Duration
	Expires(string) time.Time
	Expiration(string) string
}

func NewTimes

func NewTimes(s *Manager) Times

type Urls

type Urls interface {
	Prefix() string
	Url(string) string
	BlueprintUrl(string) string
	BlueprintUrlKey(string) string
	External(flotilla.Ctx, string, ...string) string
	Relative(flotilla.Ctx, string, ...string) string
}

Directories

Path Synopsis
A local implementation of gopkg.in/fatih/set.v0
A local implementation of gopkg.in/fatih/set.v0
Package token is an implementation of https://github.com/dgrijalva/jwt-go
Package token is an implementation of https://github.com/dgrijalva/jwt-go

Jump to

Keyboard shortcuts

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