Documentation ¶
Index ¶
- func AddHandle(key, handle string, h http.HandlerFunc) error
- func ConfigCookieSecure(secure bool)
- func GetLogin(key string, r *http.Request) (loggedin, admin bool)
- func InitialiseServer(config Config) error
- func RemoveLoginCookie(key string, rw http.ResponseWriter, r *http.Request)
- func RunServer()
- func SetLoginCookie(key string, admin bool, rw http.ResponseWriter, r *http.Request) error
- func StopServer()
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHandle ¶
func AddHandle(key, handle string, h http.HandlerFunc) error
AddHandle adds a hanler to the server. It can be called by plugins and similar.
func ConfigCookieSecure ¶
func ConfigCookieSecure(secure bool)
ConfigCookieSecure sets whether future cookies will be secure. This method can not be called in parallel with any method of server which sets cookies.
func GetLogin ¶
GetLogin returns whether the user has a valid login and whether he is administrator.
func InitialiseServer ¶
InitialiseServer initialises the server. It needs to be called first before calling any other funtion of this package.
func RemoveLoginCookie ¶
func RemoveLoginCookie(key string, rw http.ResponseWriter, r *http.Request)
RemoveLoginCookie removes all cookies for the given key. Please note that if the user can recreate the cookies on his machine, he can still log in.
func RunServer ¶
func RunServer()
RunServer starts the actual server. It does nothing if a server is already started. It will return directly after the server is started.
func SetLoginCookie ¶
SetLoginCookie creates a valid login cookie for the given key.
func StopServer ¶
func StopServer()
StopServer shuts the server down. It will do nothing if the server is not started. It will return after the shutdown is completed.