Documentation ¶
Index ¶
- Constants
- Variables
- func AddStrategy(name string, newfunc NewStrategyFunc)
- func Login(w http.ResponseWriter, r *perfect.Request)
- func Protect(handler perfect.RequestHandler) perfect.RequestHandler
- type BuiltinStrategy
- func (b *BuiltinStrategy) Attach(module *perfect.Module)
- func (b *BuiltinStrategy) Login(w http.ResponseWriter, r *perfect.Request) (profile_id *string, err error)
- func (b *BuiltinStrategy) LoginPage(w http.ResponseWriter, r *perfect.Request)
- func (b *BuiltinStrategy) Logout(w http.ResponseWriter, r *perfect.Request)
- func (b *BuiltinStrategy) Register(w http.ResponseWriter, r *perfect.Request)
- func (b *BuiltinStrategy) RegistrationPage(w http.ResponseWriter, r *perfect.Request)
- type Config
- type NewStrategyFunc
- type Strategy
Constants ¶
View Source
const ( BUILTIN = "built-in" OAUTH2 = "oauth2" LDAP = "ldap" NIS = "nis" )
authentication strategy keys
View Source
const ( SALT_ENTROPY = 3 BERR_INVALID_CREDENTIALS = "Invalid username or password" )
View Source
const (
LOGIN_PATH = "/login"
)
Variables ¶
View Source
var ( ErrInvalidUsernameOrPassword = errors.New("Invalid username or password") ErrUsernameExists = errors.New("Username already exists") )
Functions ¶
func AddStrategy ¶
func AddStrategy(name string, newfunc NewStrategyFunc)
TODO: use RWMutex in case this is called from different goroutines
func Protect ¶
func Protect(handler perfect.RequestHandler) perfect.RequestHandler
A handler that filters all requests that have not been authenticated returns 401 Unauthorized if the user's session hasn't been marked as authenticated
Types ¶
type BuiltinStrategy ¶
type BuiltinStrategy struct {
Config *Config
}
func NewBuiltinStrategy ¶
func NewBuiltinStrategy(config *Config) *BuiltinStrategy
func (*BuiltinStrategy) Attach ¶
func (b *BuiltinStrategy) Attach(module *perfect.Module)
func (*BuiltinStrategy) Login ¶
func (b *BuiltinStrategy) Login(w http.ResponseWriter, r *perfect.Request) (profile_id *string, err error)
func (*BuiltinStrategy) LoginPage ¶
func (b *BuiltinStrategy) LoginPage(w http.ResponseWriter, r *perfect.Request)
func (*BuiltinStrategy) Logout ¶
func (b *BuiltinStrategy) Logout(w http.ResponseWriter, r *perfect.Request)
default logout
func (*BuiltinStrategy) Register ¶
func (b *BuiltinStrategy) Register(w http.ResponseWriter, r *perfect.Request)
func (*BuiltinStrategy) RegistrationPage ¶
func (b *BuiltinStrategy) RegistrationPage(w http.ResponseWriter, r *perfect.Request)
type NewStrategyFunc ¶
type Strategy ¶
type Strategy interface { Attach(module *perfect.Module) LoginPage(w http.ResponseWriter, r *perfect.Request) RegistrationPage(w http.ResponseWriter, r *perfect.Request) Login(w http.ResponseWriter, r *perfect.Request) (profile_id *string, err error) Register(w http.ResponseWriter, r *perfect.Request) Logout(w http.ResponseWriter, r *perfect.Request) }
func NewBuiltinStrategyFunc ¶
Click to show internal directories.
Click to hide internal directories.