bll

package
v0.0.0-...-a2d740a Latest Latest
Warning

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

Go to latest
Published: May 9, 2015 License: GPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_CORS_PREFLIGHT_METHOD = "OPTIONS"
	DEFAULT_CORS_MAX_AGE          = time.Hour * 24 / time.Second
	DEFAULT_CORS_METHODS          = "OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT"
	DEFAULT_CORS_ORIGIN           = "*"
)
View Source
const (
	HTTP_BODY_MAX_LENGTH = 1048576
	// WebDAV; RFC 4918
	StatusUnprocessableEntity = 422
)
View Source
const (
	BASIC_PREFIX = "Basic "
)

Variables

This section is empty.

Functions

func JsonRead

func JsonRead(body io.ReadCloser, obj interface{}, w http.ResponseWriter) bool

func JsonWrite

func JsonWrite(w http.ResponseWriter, status int, content interface{})

func TrueForAll

func TrueForAll(string) bool

Types

type AppContext

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

func (*AppContext) InitDb

func (c *AppContext) InitDb() error

func (*AppContext) InitTokenStore

func (c *AppContext) InitTokenStore() error

func (*AppContext) LoggingHandler

func (c *AppContext) LoggingHandler(next http.Handler) http.Handler

func (*AppContext) SetConfiguration

func (c *AppContext) SetConfiguration(cfg *Configuration)

type Application

type Application struct {
	Port          uint16
	Secret        string
	TokenLife     string
	AuthTokenLife string
}

func (*Application) GetAuthTokenLifeDuration

func (app *Application) GetAuthTokenLifeDuration() time.Duration

func (*Application) GetTokenLifeDuration

func (app *Application) GetTokenLifeDuration() time.Duration

type CORSHandler

type CORSHandler struct {
	PredicateOrigin PredicateStringFunc
	Headers         []string
	ExposedHeaders  []string
}

func NewCORSHandler

func NewCORSHandler() *CORSHandler

func (*CORSHandler) CreateOptionsRoutes

func (s *CORSHandler) CreateOptionsRoutes(routes rqhttp.Routes) rqhttp.Routes

type CORSMethod

type CORSMethod struct {
	CORSHandler
	UseCredentials bool
}

func (*CORSMethod) CORSMiddleware

func (s *CORSMethod) CORSMiddleware(next http.Handler) http.Handler

type CORSPreflight

type CORSPreflight struct {
	CORSHandler
	Methods        []string
	UseCredentials bool
}

func (*CORSPreflight) ServeHTTP

func (s *CORSPreflight) ServeHTTP(w http.ResponseWriter, r *http.Request)

type CORSRouter

type CORSRouter struct {
	AllowOrigin         PredicateStringFunc
	PreflightMiddleware rqhttp.HttpMiddlewareFunc
	// contains filtered or unexported fields
}

type Configuration

type Configuration struct {
	Application
	Database
}

func (*Configuration) Load

func (c *Configuration) Load(path string) error

type Database

type Database struct {
	Engine   string
	Host     string
	Port     uint16
	Name     string
	User     string
	Password string
	Protocol string
	DbArgs   string
}

func (*Database) GetConnectionString

func (db *Database) GetConnectionString() (string, error)

type HttpAuthenticable

type HttpAuthenticable interface {
	TryAuthentication(r *http.Request, user, secret string) bool
}

type HttpBasicAuthenticator

type HttpBasicAuthenticator struct {
	HttpAuthenticable
}

func (HttpBasicAuthenticator) BasicAuth

func (self HttpBasicAuthenticator) BasicAuth(next http.Handler) http.Handler

type Install

type Install struct {
	Context *AppContext
}

func (*Install) CreateFirstUser

func (self *Install) CreateFirstUser(w http.ResponseWriter, r *http.Request)

func (*Install) GetInstallStatus

func (self *Install) GetInstallStatus(w http.ResponseWriter, r *http.Request)

func (*Install) Routes

func (self *Install) Routes() rqhttp.Routes

type IntStringTuple

type IntStringTuple struct {
	Item1 int
	Item2 string
}

type Languages

type Languages struct {
	Context *AppContext
}

func (*Languages) GetLanguages

func (self *Languages) GetLanguages(w http.ResponseWriter, r *http.Request)

func (*Languages) Routes

func (self *Languages) Routes() rqhttp.Routes

type Logon

type Logon struct {
	Context *AppContext
}

func (*Logon) Destroy

func (self *Logon) Destroy(w http.ResponseWriter, r *http.Request)

func (*Logon) Routes

func (self *Logon) Routes() rqhttp.Routes

func (*Logon) TryAuthentication

func (self *Logon) TryAuthentication(r *http.Request, user, secret string) bool

func (*Logon) Validate

func (self *Logon) Validate(w http.ResponseWriter, r *http.Request)

type PredicateStringFunc

type PredicateStringFunc func(string) bool

type Session

type Session struct {
	Context *AppContext
}

func (*Session) Create

func (s *Session) Create(w http.ResponseWriter, r *http.Request)

func (*Session) Destroy

func (s *Session) Destroy(w http.ResponseWriter, r *http.Request)

func (*Session) Validate

func (s *Session) Validate(w http.ResponseWriter, r *http.Request)

type StringSlice

type StringSlice []string

func (StringSlice) Exists

func (s StringSlice) Exists(str string) bool

func (StringSlice) ExistsAllIgnoreCase

func (s StringSlice) ExistsAllIgnoreCase(str []string) bool

func (StringSlice) ExistsIgnoreCase

func (s StringSlice) ExistsIgnoreCase(str string) bool

func (StringSlice) IndexOf

func (s StringSlice) IndexOf(str string) int

func (StringSlice) IndexOfIgnoreCase

func (s StringSlice) IndexOfIgnoreCase(str string) int

Jump to

Keyboard shortcuts

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