api

package
v0.0.0-...-a6b3528 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2016 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(listenAddr net.TCPAddr, datasource *datasource.DataSource) error

Types

type AuthBearerMiddleware

type AuthBearerMiddleware struct {
	// Realm name to display to the user. Required.
	Realm string

	// Callback function that should perform the authentication of the user based on token.
	// Must return userID as string on success, empty string on failure. Required.
	// The returned userID is normally the primary key for your user record.
	Authenticator func(token string) string

	// Callback function that should perform the authorization of the authenticated user.
	// Must return true on success, false on failure. Optional, defaults to success.
	// Called only after an authentication success.
	Authorizer func(request *rest.Request, userID string) bool
}

AuthBearerMiddleware provides a Token Auth implementation. On success, the wrapped middleware is called, and the userID is made available as request.Env["REMOTE_USER"].(string)

func (*AuthBearerMiddleware) MiddlewareFunc

func (mw *AuthBearerMiddleware) MiddlewareFunc(handler rest.HandlerFunc) rest.HandlerFunc

MiddlewareFunc makes AuthBearerMiddleware implement the Middleware interface.

type ChangePassword

type ChangePassword struct {
	OldPassword string `json:"oldPassword"`
	NewPassword string `json:"newPassword"`
}

type GroupInList

type GroupInList struct {
	Email       string `json:"email"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Active      bool   `json:"active"`
	Public      bool   `json:"public"`
	Joinable    bool   `json:"joinable"`
	Manager     string `json:"manager"`
	Joined      bool   `json:"joined"`
}

type UserInList

type UserInList struct {
	Email       string `json:"email"`
	UIDStr      string `json:"uid"`
	InboxAddr   string `json:"inboxAddress"`
	Active      bool   `json:"active"`
	Admin       bool   `json:"admin"`
	EnFirstName string `json:"enFirstName"`
	EnLastName  string `json:"enLastName"`
	FaFirstName string `json:"faFirstName"`
	FaLastName  string `json:"faLastName"`
}

Jump to

Keyboard shortcuts

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