Documentation ¶
Index ¶
- Constants
- Variables
- func AddActivityLog(r *http.Request, user, operation, target, content string, args []*Arg)
- func Create(config *Config) (http.Handler, error)
- func IsDirExist(dir string) bool
- func MustUsername(req *http.Request) string
- func NewAccountHandler(userDetailsService IUserDetailsService, ser http.Handler, blacklist []string) http.Handler
- func RetTemplate(baseDir string, appends ...string)
- func SetActivityLogAddHandler(h ActivityLogAddHandler, fileterForwarded bool)
- type AccountHandler
- type ActivityLogAddHandler
- type ActivityLogGetHandler
- type Arg
- type Config
- type IModule
- type IOperation
- type IUserDetailsService
- type LogEntity
- type Module
- type ModuleItem
- type ModuleItemPlan
- type ModuleViewFinder
- type Operation
- type SessionManager
- type TemplateWriter
- type UserDetails
- type ViewHandlerFunc
- type ViewLookup
- type ViewServer
- type Views
- type ZoneName
Constants ¶
View Source
const ( SessionName = "SESSIONID" CallBack = "callback" )
View Source
const ( OptLogin = "login" OptLogout = "logout" OptCreate = "create" OptUpdate = "update" OptDelete = "delete" )
Variables ¶
View Source
var ( ErrorNotLogin = errors.New("not login") ErrorUsernameNotFound = errors.New("username not found") ErrorUserDetailsServiceNeed = errors.New("need UserDetailsService") )
View Source
var UserDetailsKey = userDetailsKey{}
UserDetailsKey is the request context key under which UserDetails are stored.
Functions ¶
func AddActivityLog ¶
func MustUsername ¶
func NewAccountHandler ¶
func RetTemplate ¶
func SetActivityLogAddHandler ¶
func SetActivityLogAddHandler(h ActivityLogAddHandler, fileterForwarded bool)
Types ¶
type AccountHandler ¶
type AccountHandler struct {
// contains filtered or unexported fields
}
func (*AccountHandler) Api ¶
func (h *AccountHandler) Api(w http.ResponseWriter, r *http.Request)
func (*AccountHandler) Clear ¶
func (h *AccountHandler) Clear()
func (*AccountHandler) Post ¶
func (h *AccountHandler) Post(w http.ResponseWriter, r *http.Request)
func (*AccountHandler) View ¶
func (h *AccountHandler) View(w http.ResponseWriter, r *http.Request)
type ActivityLogAddHandler ¶
type ActivityLogGetHandler ¶
type Config ¶
type Config struct { DefaultZone ZoneName Modules []*Module UserDetailsService IUserDetailsService DefaultModule string }
type IModule ¶
type IModule interface { http.Handler ViewLookup }
type IOperation ¶
type IOperation interface { }
type IUserDetailsService ¶
type IUserDetailsService interface { // LoadUserByUsername Locates the user based on the username. LoadUserByUsername(username string) (UserDetails, error) }
type ModuleItem ¶
type ModuleItemPlan ¶
type ModuleItemPlan struct {
// contains filtered or unexported fields
}
func NewModuleItemPlan ¶
func NewModuleItemPlan(modules []*ModuleItem) *ModuleItemPlan
func (*ModuleItemPlan) CreateViewData ¶
func (mp *ModuleItemPlan) CreateViewData(name string, data interface{}, err error, user UserDetails) map[string]interface{}
type ModuleViewFinder ¶
type ModuleViewFinder struct {
// contains filtered or unexported fields
}
func NewViewModuleEmpty ¶
func NewViewModuleEmpty(prefix string, views map[string]string, defaultName string) *ModuleViewFinder
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
func NewSessionManager ¶
func NewSessionManager() *SessionManager
func (*SessionManager) Delete ¶
func (sm *SessionManager) Delete(session string)
func (*SessionManager) Get ¶
func (sm *SessionManager) Get(session string) (UserDetails, bool)
func (*SessionManager) Set ¶
func (sm *SessionManager) Set(session string, details UserDetails)
type TemplateWriter ¶
type TemplateWriter struct {
// contains filtered or unexported fields
}
func NewTemplateWriter ¶
func NewTemplateWriter() *TemplateWriter
func (*TemplateWriter) Header ¶
func (t *TemplateWriter) Header() http.Header
func (*TemplateWriter) WriteHeader ¶
func (t *TemplateWriter) WriteHeader(statusCode int)
func (*TemplateWriter) WriteHeaderTo ¶
func (t *TemplateWriter) WriteHeaderTo(w http.ResponseWriter)
func (*TemplateWriter) WriteTo ¶
func (t *TemplateWriter) WriteTo(w http.ResponseWriter)
type UserDetails ¶
type UserDetails interface { // GetUsername Returns the username used to authenticate the user. GetUsername() string // GetAuthorities Returns the authorities granted to the user. GetAuthorities() map[string]interface{} // GetPassword Returns the password used to authenticate the user. GetPassword() string // IsAccountNonExpired Indicates whether the user's account has expired. IsAccountNonExpired() bool // IsAccountNonLocked Indicates whether the user is locked or unlocked. IsAccountNonLocked() bool // IsCredentialsNonExpired Indicates whether the user's credentials (password) has expired. IsCredentialsNonExpired() bool // IsEnabled Indicates whether the user is enabled or disabled. IsEnabled() bool }
func UserDetailsFromRequest ¶
func UserDetailsFromRequest(req *http.Request) (UserDetails, error)
type ViewHandlerFunc ¶
type ViewLookup ¶
type ViewServer ¶
type ViewServer struct {
// contains filtered or unexported fields
}
func (*ViewServer) ServeHTTP ¶
func (v *ViewServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Views ¶
type Views struct {
// contains filtered or unexported fields
}
func (*Views) Error ¶
func (v *Views) Error(w http.ResponseWriter, cache *TemplateWriter)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.