package module
Version: v0.1.18 Latest Latest

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

Go to latest
Published: Oct 6, 2020 License: BSD-3-Clause Imports: 15 Imported by: 0




This section is empty.


This section is empty.


func NilHandlerFunc added in v0.1.2

func NilHandlerFunc(wr http.ResponseWriter, req *http.Request)

func ViewBagMiddleware added in v0.1.2

func ViewBagMiddleware(next http.Handler) http.Handler


type AppRoute added in v0.1.2

type AppRoute struct {
	Tag                 string
	DisplayName         string
	URI                 string
	HttpMethods         []string
	HandlerFunc         http.HandlerFunc
	VisibleMenu         bool
	RequiredPermissions []string
	TemplateChain       templates.TemplateChain
	Children            []*AppSubRoute

func (*AppRoute) HasVisibleChildren added in v0.1.2

func (route *AppRoute) HasVisibleChildren() bool

type AppSubRoute added in v0.1.2

type AppSubRoute struct {
	Tag                 string
	DisplayName         string
	URI                 string
	HttpMethods         []string
	HandlerFunc         http.HandlerFunc
	VisibleMenu         bool
	RequiredPermissions []string
	TemplateChain       templates.TemplateChain

type AuthenticatedUser added in v0.1.2

type AuthenticatedUser struct {
	Username  string
	Fullname  string
	Firstname string
	Lastname  string
	Email     string

type Authenticater added in v0.1.2

type Authenticater interface {
	Authenticate(username string, password string) (*AuthenticatedUser, error)

type ChiApplication

type ChiApplication struct {
	Logger logging.Logger

	SessProvider *SessionProvider

	BaseURI string
	Routes  []*AppRoute
	AppName string
	// contains filtered or unexported fields

func (*ChiApplication) Init added in v0.1.2

func (*ChiApplication) RedirectToApp added in v0.1.2

func (app *ChiApplication) RedirectToApp(wr http.ResponseWriter, r *http.Request)

Helper handler that can be used to redirect to the root of the app

func (*ChiApplication) Router

func (app *ChiApplication) Router(baseURI string) chi.Router

type ContextKey added in v0.1.2

type ContextKey string

#region Types

type InMemoryAuthenticater added in v0.1.2

type InMemoryAuthenticater struct {
	Credentials map[string]string

func (*InMemoryAuthenticater) Authenticate added in v0.1.2

func (me *InMemoryAuthenticater) Authenticate(username string, password string) (*AuthenticatedUser, error)

type InMemoryPrincipleRepository added in v0.1.3

type InMemoryPrincipleRepository map[string]*PermissionPrincipal

func (InMemoryPrincipleRepository) GetPermissionPrinciple added in v0.1.3

func (imp InMemoryPrincipleRepository) GetPermissionPrinciple(id string) *PermissionPrincipal

type InMemorySessionRepository added in v0.1.2

type InMemorySessionRepository map[uuid.UUID]*Session

func (InMemorySessionRepository) DeleteSession added in v0.1.2

func (sr InMemorySessionRepository) DeleteSession(key uuid.UUID) error

func (InMemorySessionRepository) GetAllSessions added in v0.1.15

func (sr InMemorySessionRepository) GetAllSessions() ([]*Session, error)

func (InMemorySessionRepository) GetSession added in v0.1.2

func (sr InMemorySessionRepository) GetSession(key uuid.UUID) (*Session, error)

func (InMemorySessionRepository) StoreSession added in v0.1.2

func (sr InMemorySessionRepository) StoreSession(key uuid.UUID, sess *Session) error

type Permission added in v0.1.3

type Permission struct {
	Key         string
	Description string

type PermissionManager added in v0.1.3

type PermissionManager struct {
	// contains filtered or unexported fields

func NewPermissionManager added in v0.1.3

func NewPermissionManager(repo PermissionPrincipalGetter) *PermissionManager

type PermissionPrincipal added in v0.1.3

type PermissionPrincipal struct {
	ID    string
	Roles []*Role

type PermissionPrincipalGetter added in v0.1.3

type PermissionPrincipalGetter interface {
	GetPermissionPrinciple(id string) *PermissionPrincipal

type Role added in v0.1.3

type Role struct {
	Name        string
	Permissions []*Permission

type Session added in v0.1.2

type Session struct {
	Expiration time.Time
	User       *AuthenticatedUser
	Data       map[string]SessionDataItem
	Messages   []string
	Errors     []string
	// contains filtered or unexported fields

func (*Session) DeleteVal added in v0.1.2

func (s *Session) DeleteVal(key string) error

func (*Session) GetVal added in v0.1.2

func (s *Session) GetVal(key string) interface{}

func (*Session) MustDeleteVal added in v0.1.2

func (s *Session) MustDeleteVal(key string)

func (*Session) MustPopError added in v0.1.2

func (s *Session) MustPopError() string

func (*Session) MustPopMessage added in v0.1.2

func (s *Session) MustPopMessage() string

func (*Session) MustPushError added in v0.1.2

func (s *Session) MustPushError(err string)

func (*Session) MustPushMessage added in v0.1.2

func (s *Session) MustPushMessage(message string)

func (*Session) MustSetUser added in v0.1.11

func (s *Session) MustSetUser(u *AuthenticatedUser)

func (*Session) MustStoreVal added in v0.1.2

func (s *Session) MustStoreVal(key string, val SessionDataItem)

func (*Session) PopError added in v0.1.2

func (s *Session) PopError() (string, error)

func (*Session) PopMessage added in v0.1.2

func (s *Session) PopMessage() (string, error)

func (*Session) PushError added in v0.1.2

func (s *Session) PushError(err string) error

func (*Session) PushMessage added in v0.1.2

func (s *Session) PushMessage(message string) error

func (*Session) SetUser added in v0.1.11

func (s *Session) SetUser(u *AuthenticatedUser) error

func (*Session) StoreVal added in v0.1.2

func (s *Session) StoreVal(key string, val SessionDataItem) error

type SessionDataItem added in v0.1.11

type SessionDataItem struct {
	StringVal string
	IntVal    int
	BoolVal   bool

#region Sessions

type SessionGetterStorerDeleter added in v0.1.2

type SessionGetterStorerDeleter interface {
	GetAllSessions() ([]*Session, error)
	GetSession(key uuid.UUID) (*Session, error)
	StoreSession(key uuid.UUID, sess *Session) error
	DeleteSession(key uuid.UUID) error

type SessionProvider added in v0.1.2

type SessionProvider struct {
	Logger     logging.Logger
	Repository SessionGetterStorerDeleter
	// contains filtered or unexported fields

func NewSessionProvider added in v0.1.2

func NewSessionProvider(logger logging.Logger, repository SessionGetterStorerDeleter, sessionTTL time.Duration) *SessionProvider

func (*SessionProvider) DeleteSession added in v0.1.2

func (me *SessionProvider) DeleteSession(id string) error

func (*SessionProvider) MustDeleteSession added in v0.1.2

func (me *SessionProvider) MustDeleteSession(id string)

func (*SessionProvider) MustNewSession added in v0.1.2

func (me *SessionProvider) MustNewSession(data map[string]SessionDataItem) (string, *Session)

func (*SessionProvider) MustRetrieve added in v0.1.2

func (me *SessionProvider) MustRetrieve(id string) *Session

func (*SessionProvider) NewSession added in v0.1.2

func (me *SessionProvider) NewSession(data map[string]SessionDataItem) (string, *Session, error)

func (*SessionProvider) Retrieve added in v0.1.2

func (me *SessionProvider) Retrieve(id string) (*Session, error)

func (*SessionProvider) SessionMiddleware added in v0.1.2

func (me *SessionProvider) SessionMiddleware(next http.Handler) http.Handler

func (*SessionProvider) SessionTTL added in v0.1.2

func (me *SessionProvider) SessionTTL() time.Duration

func (*SessionProvider) SetSessionTTL added in v0.1.2

func (me *SessionProvider) SetSessionTTL(ttl time.Duration)

type ViewBag added in v0.1.2

type ViewBag map[string]interface{}

func ViewBagFor added in v0.1.2

func ViewBagFor(req *http.Request) ViewBag


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL