MCPcopy Index your code
hub / github.com/coder/coder / SubdomainAppSessionTokenCookie

Function SubdomainAppSessionTokenCookie

coderd/workspaceapps/cookies.go:55–60  ·  view source on GitHub ↗

SubdomainAppSessionTokenCookie returns the cookie name for the subdomain app session token. This is unique per workspace proxy and is based on a hash of the workspace proxy subdomain hostname. The reason the cookie needs to be unique per workspace proxy is to avoid cookies from one proxy (e.g. the

(hostname string)

Source from the content-addressed store, hash-verified

53//
54// By using a unique cookie name per workspace proxy, we can avoid this issue.
55func SubdomainAppSessionTokenCookie(hostname string) string {
56 hash := sha256.Sum256([]byte(hostname))
57 // 16 bytes of uniqueness is probably enough.
58 str := hex.EncodeToString(hash[:16])
59 return codersdk.SubdomainAppSessionTokenCookie + "_" + str
60}
61
62// AppConnectSessionTokenFromRequest returns the session token from the request
63// if it exists. The access method is used to determine which cookie name to

Callers 1

NewAppCookiesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected