WebSocketChat

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetURL

func GetURL(uri string, XssiPrefix []string, args ...string) (status int, rv string)

------------------------------------------------------------------------------------------------------------------------------

func Useless

func Useless()

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a middleman between the websocket connection and the hub.

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

hub maintains the set of active clients and broadcasts messages to the clients.

type LoginRequiredType

type LoginRequiredType struct {
	Next                 http.Handler //
	Paths                []string     //
	Name                 string       // web socket monitoring name
	StrongLoginReq       string       //
	AuthMethod           []string     //
	Final                string       //
	ValidationSource     string       //
	RedisAuthTokenPrefix string       //
	RedisSessionPrefix   string       // Deprecated!
	PostgresQuery        string       //
	ParamName            string       //
	KeyFile              string       // public key for verification. (private is used for signing)
	CheckXsrfToken       string       // validate that the X-Xsrf-Token is set correctly for this session
	RemoteValidate       string       // yes means that you should use RemoteValidateURL to validate the "auth_token"
	RemoteValidateURL    string       //
	RemoteValidatePrefix string       // prefix for keeping auth_token when jwi
	DefaultTTL           string       //
	XssiPrefix           []string     //
	LineNo               int          //
	// contains filtered or unexported fields
}

func NewLoginRequiredServer

func NewLoginRequiredServer(n http.Handler, p []string) *LoginRequiredType

func (*LoginRequiredType) GetBearer

func (hdlr *LoginRequiredType) GetBearer(req *http.Request) (rv string)

Look for an Authentication header with a 'bearer' and pull that out

func (*LoginRequiredType) GetCookie

func (hdlr *LoginRequiredType) GetCookie(CookieName string, req *http.Request) (rv string)

func (*LoginRequiredType) GetData

func (hdlr *LoginRequiredType) GetData(ParamName string, ps *goftlmux.Params) (rv string)

func (*LoginRequiredType) GetDataPost

func (hdlr *LoginRequiredType) GetDataPost(ParamName string, ps *goftlmux.Params) (rv string)

func (*LoginRequiredType) GetRedisKey

func (hdlr *LoginRequiredType) GetRedisKey(key string) (rv string, err error)

func (*LoginRequiredType) GetSessionAuth

func (hdlr *LoginRequiredType) GetSessionAuth() (rv string)

func (*LoginRequiredType) GetXsrfToken

func (hdlr *LoginRequiredType) GetXsrfToken(req *http.Request) (rv string)

func (*LoginRequiredType) InitializeWithConfigData

func (hdlr *LoginRequiredType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*LoginRequiredType) InjextXsrf

func (hdlr *LoginRequiredType) InjextXsrf(rw *goftlmux.MidBuffer, www http.ResponseWriter, xsrf_token string)

func (*LoginRequiredType) MergeSessionData

func (hdlr *LoginRequiredType) MergeSessionData(rw *goftlmux.MidBuffer, logged_in bool)

func (*LoginRequiredType) PreValidate

func (hdlr *LoginRequiredType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (*LoginRequiredType) RedisSetContains

func (hdlr *LoginRequiredType) RedisSetContains(key, item string) (found bool, err error)

xref_in_set, err := hdlr.RedisSetContains("ses__xsrf:" + sc, xt) // trx__xsrf: shoud be set in config SMEMBERS on old key, 'xt'

func (*LoginRequiredType) RedisUpdateSet

func (hdlr *LoginRequiredType) RedisUpdateSet(key string, ttl int, new, old string) (err error)

SREM old key, SADD new key hdlr.RedisUpdateSet("ses__xsrf:"+sc, 60*60*24*30, xsrf_token, xt) // save the token locally for revalidation when new one fetched

func (*LoginRequiredType) ServeHTTP

func (hdlr *LoginRequiredType) ServeHTTP(www http.ResponseWriter, req *http.Request)

func (*LoginRequiredType) SetRedisKey

func (hdlr *LoginRequiredType) SetRedisKey(key string, ttl int, value string) (err error)

func (*LoginRequiredType) ValidateAuthToken

func (hdlr *LoginRequiredType) ValidateAuthToken(rw *goftlmux.MidBuffer, www http.ResponseWriter, req *http.Request, auth_token string) (valid, first bool, xsrf_token string, ttl int)

func (*LoginRequiredType) VerifyToken

func (hdlr *LoginRequiredType) VerifyToken(tokData []byte, keyFile string) (iat string, err error)

Verify a token and output the claims. This is a great example of how to verify and view a token.

Jump to

Keyboard shortcuts

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