Documentation ¶
Index ¶
- func CheckMiddleware(next http.Handler) http.Handler
- func Set(newConfig ConfigStruct)
- func SetNewSessionCookie(res http.ResponseWriter, req *http.Request, username string) (newSession *session.Session)
- type ConfigStruct
- type Middleware
- func (mdw *Middleware) CheckMiddleware(next http.Handler) http.Handler
- func (mdw *Middleware) DeRegister(sessionID string)
- func (middleware *Middleware) GetAllSessionInfos() (infos []session.SessionInfo)
- func (middleware *Middleware) GetSessionInfos(username string) (infos []session.SessionInfo)
- func (mdw *Middleware) HookOnFail(hook func(req *http.Request))
- func (mdw *Middleware) HookOnSuccess(hook func(req *http.Request))
- func (mdw *Middleware) Init()
- func (mdw Middleware) Name() string
- func (middleware *Middleware) PublishToAll(msg *message.Message)
- func (mdw *Middleware) Set(newConfig ConfigStruct)
- func (mdw *Middleware) SetCheckIntervall(intervall time.Duration)
- func (mdw *Middleware) SetNewSessionCookie(res http.ResponseWriter, req *http.Request, username string) (newSession *session.Session)
- func (mdw *Middleware) SetTimeout(timeout time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Set ¶ added in v2.2.0
func Set(newConfig ConfigStruct)
func SetNewSessionCookie ¶
func SetNewSessionCookie(res http.ResponseWriter, req *http.Request, username string) (newSession *session.Session)
SetNewSessionCookie create a new session and store it as cookie in r
Types ¶
type ConfigStruct ¶
type ConfigStruct struct { Timeout time.Duration `yaml:"timeout"` // defaults to 60 Intervall time.Duration `yaml:"intervall"` // defaults to 90 }
func (*ConfigStruct) MarshalZerologObject ¶ added in v2.2.0
func (c *ConfigStruct) MarshalZerologObject(e *zerolog.Event)
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Define our struct
func (*Middleware) CheckMiddleware ¶ added in v2.4.0
func (mdw *Middleware) CheckMiddleware(next http.Handler) http.Handler
provide a middleware that check if your session is valid
This inject the session into your request-context and can be received with session.FromContext()
func (*Middleware) DeRegister ¶
func (mdw *Middleware) DeRegister(sessionID string)
DeRegister close and remove an session
This function do not LOCK the sessionlist
func (*Middleware) GetAllSessionInfos ¶
func (middleware *Middleware) GetAllSessionInfos() (infos []session.SessionInfo)
func (*Middleware) GetSessionInfos ¶
func (middleware *Middleware) GetSessionInfos(username string) (infos []session.SessionInfo)
GetSessionInfos return all sessions for an given user
func (*Middleware) HookOnFail ¶ added in v2.4.0
func (mdw *Middleware) HookOnFail(hook func(req *http.Request))
func (*Middleware) HookOnSuccess ¶ added in v2.4.0
func (mdw *Middleware) HookOnSuccess(hook func(req *http.Request))
func (*Middleware) Init ¶
func (mdw *Middleware) Init()
func (Middleware) Name ¶
func (mdw Middleware) Name() string
func (*Middleware) PublishToAll ¶
func (middleware *Middleware) PublishToAll(msg *message.Message)
func (*Middleware) Set ¶ added in v2.2.0
func (mdw *Middleware) Set(newConfig ConfigStruct)
func (*Middleware) SetCheckIntervall ¶
func (mdw *Middleware) SetCheckIntervall(intervall time.Duration)
SetCheckInterval set the intervall for check of sessions
func (*Middleware) SetNewSessionCookie ¶ added in v2.5.1
func (mdw *Middleware) SetNewSessionCookie(res http.ResponseWriter, req *http.Request, username string) (newSession *session.Session)
SetNewSessionCookie create a new session and store it as cookie in r
func (*Middleware) SetTimeout ¶
func (mdw *Middleware) SetTimeout(timeout time.Duration)
SetTimeout will set the timeout for an existing session the session will be removed after timeout when no action is performed by the user
Click to show internal directories.
Click to hide internal directories.