|
|
@@ -3,6 +3,7 @@ import { Effect, Encoding, Layer, Redacted } from "effect"
|
|
|
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/unstable/http"
|
|
|
import { HttpApiError, HttpApiMiddleware } from "effect/unstable/httpapi"
|
|
|
import { hasPtyConnectTicketURL } from "@/server/shared/pty-ticket"
|
|
|
+import { isPublicUIPath } from "@/server/shared/public-ui"
|
|
|
|
|
|
const AUTH_TOKEN_QUERY = "auth_token"
|
|
|
const UNAUTHORIZED = 401
|
|
|
@@ -92,6 +93,7 @@ export const authorizationRouterMiddleware = HttpRouter.middleware()(
|
|
|
Effect.gen(function* () {
|
|
|
const request = yield* HttpServerRequest.HttpServerRequest
|
|
|
const url = new URL(request.url, "http://localhost")
|
|
|
+ if (isPublicUIPath(request.method, url.pathname)) return yield* effect
|
|
|
if (hasPtyConnectTicketURL(url)) return yield* effect
|
|
|
return yield* credentialFromURL(url, request).pipe(
|
|
|
Effect.flatMap((credential) => validateRawCredential(effect, credential, config)),
|