MCPcopy Index your code
hub / github.com/coder/code-server / ensureAuthenticated

Function ensureAuthenticated

src/node/http.ts:100–112  ·  view source on GitHub ↗
(
  req: express.Request,
  _?: express.Response,
  next?: express.NextFunction,
)

Source from the content-addressed store, hash-verified

98 * Throw an error if not authorized. Call `next` if provided.
99 */
100export const ensureAuthenticated = async (
101 req: express.Request,
102 _?: express.Response,
103 next?: express.NextFunction,
104): Promise<void> => {
105 const isAuthenticated = await authenticated(req)
106 if (!isAuthenticated) {
107 throw new HttpError("Unauthorized", HttpCode.Unauthorized)
108 }
109 if (next) {
110 next()
111 }
112}
113
114/**
115 * Return true if authenticated via cookies.

Callers 2

domainProxy.tsFile · 0.90
wsProxyFunction · 0.90

Calls 1

authenticatedFunction · 0.85

Tested by

no test coverage detected