Documentation ¶
Index ¶
- Constants
- func DefaultRoles(r *http.Request, authorizer rbac.Authorizer, connUUID string, ...) ([]rbac.Role, error)
- func GenerateAuthCookie(cookieData *rbac.AuthCookieData) (*http.Cookie, error)
- func GetCurrentDirectory() string
- func NamespaceFromRequest(req *http.Request) (string, error)
- func SerializeIntoResponse(codec api.ApiCodec, dest interface{}) error
- func SetAuthCookie(w http.ResponseWriter, r *http.Request, namespace connection.Namespace, ...) (bool, error)
- func UpdateClientUsername(c *client.Client, username string, clientHandler client.SocketClientHandler) error
- func UpdatedAuthCookie(r *http.Request, namespace connection.Namespace, roles []rbac.Role) (*http.Cookie, bool, error)
Constants ¶
const ROOM_URL_SEGMENT = "/v/"
Variables ¶
This section is empty.
Functions ¶
func DefaultRoles ¶
func DefaultRoles(r *http.Request, authorizer rbac.Authorizer, connUUID string, namespace connection.Namespace) ([]rbac.Role, error)
BindDefaultuserRoles computes the default roles to assign to a given connection request based on previously stored auth data as well as a connection's namespace state. The following rules will be followed (in the given order) when determining which roles to return:
- If no other connections are bound to the given namespace, an "admin" role will be assigned and forced onto the connection - regardless of previously stored data on an existing auth cookie.
- If auth information was previously stored in an auth cookie, and the computed role based on the namespace state is not "admin", the stored roles will be forced onto the connection.
- If there is no previously stored information for the given namespace in an auth cookie, or the auth cookie does not exist, and there is at least one other connection assigned to the given namespace, a "user" role will be forced onto the connection.
func GenerateAuthCookie ¶
func GenerateAuthCookie(cookieData *rbac.AuthCookieData) (*http.Cookie, error)
func GetCurrentDirectory ¶
func GetCurrentDirectory() string
func NamespaceFromRequest ¶
GetRoomNameFromRequest receives a socket connection request and returns a fully-qualified room name from the request's referer information
func SerializeIntoResponse ¶
serializeIntoResponse receives an api.ApiCodec and serializes it into a given structure pointer.
func SetAuthCookie ¶
func SetAuthCookie(w http.ResponseWriter, r *http.Request, namespace connection.Namespace, roles []rbac.Role) (bool, error)
func UpdateClientUsername ¶
func UpdateClientUsername(c *client.Client, username string, clientHandler client.SocketClientHandler) error
TODO: make this function concurrency-safe
func UpdatedAuthCookie ¶
func UpdatedAuthCookie(r *http.Request, namespace connection.Namespace, roles []rbac.Role) (*http.Cookie, bool, error)
UpdatedAuthCookie receives a request, namespace, and set of roles and returns an existing auth cookie with its role data updated, or a new auth cookie with the given role data
Types ¶
This section is empty.