handler

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2016 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(c Config) authkit.Handler

NewHandler returns default Handler implemetation. All arguments except ContextCreator and Validator must be provided. If ContextCreator is nil, then DefaultContextCreator is used. If Validator is nil, then default password validator is used.

func SimpleLoginValidator

func SimpleLoginValidator(s string) bool

SimpleLoginValidator checks user name (login) against following rules: - length 5..20 chars - first char is a letter - allowed chars: latin letters, digits, hyphen, underscore. Note: these restrictions are pure arbitrary, just to have some (we should have some as a proiphylactic against injections).

Types

type Config

type Config struct {

	// OAuth2Providers stores configuration of all registered external OAuth2
	// providers (except application's private OAuth2 provider).
	OAuth2Providers []authkit.OAuth2Provider

	// PrivateOAuth2Provider is a configuration of private OAuth2
	// provider. Private provider can be implemented by the app itself,
	// or it can be a third-party application. In both cases, it should
	// be available via http.
	PrivateOAuth2Provider authkit.OAuth2Provider

	// OAuth2State is a configuration of OAuth2 code flow state token.
	OAuth2State authkit.OAuth2State

	// AuthCookieName is a name of cookie to be used to send auth token to
	// the client.
	AuthCookieName string

	// ModTime is a configuration modification time. It is used to
	// cache list of providers on client (with "If-Modified_Since" header).
	ModTime time.Time

	ErrorCustomizer       authkit.ErrorCustomizer
	AuthService           authkit.HandlerAuthService
	UserService           authkit.HandlerUserService
	ProfileService        authkit.ProfileService
	SocialProfileServices authkit.SocialProfileServices
	ContextCreator        authkit.ContextCreator
	PasswordValidator     govalidator.Validator
	LoginValidator        govalidator.Validator
}

Config holds configuration parmeters for handler.NewHandler().

func (Config) Valid

func (c Config) Valid() bool

Jump to

Keyboard shortcuts

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