Replies: 2 comments
-
|
I think this is an essential feature. I am hoping to also use this for some adult education courses we will be offering. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Thanks for the thorough RFC! We've included ACCESS_CODE in the v0.1.1 roadmap (#406). We're going with a simpler variant: Next.js middleware + simple session cookie instead of proxy.ts + HMAC. Same goal, less moving parts. On your questions:
Happy to have your help on the implementation — feel free to open a PR. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Motivation
Ref: #287
When deploying OpenMAIC on Vercel for a class or research group, deployers need a way to restrict site access without exposing their LLM API keys. Currently, the codebase does not implement
CODE/ACCESS_CODE/HIDE_USER_API_KEY— the environment variables are silently ignored, leaving deployments open to anyone with the URL.A teacher in #287 is trying to share a deployment with 700 students(——wow!) while keeping their
DOUBAO_API_KEYsafe. Without access control, anyone can consume their API quota.Proposed Solution
A zero-dependency, purely additive access-code gate using Next.js 16's
proxy.ts:Architecture
New files (no changes to existing code)
proxy.ts/auth; return 401 for API callslib/server/access-auth.tsapp/api/auth/login/route.tsHttpOnlycookieapp/api/auth/logout/route.tsapp/auth/page.tsxEnvironment variables
ACCESS_CODECODEalso supported as alias)AUTH_SECRETAUTH_TTL_HOURSKey design decisions
ACCESS_CODEis not set, behavior is identical to todayWhat this does NOT solve (yet)
The deeper issue from #287 — when
HIDE_USER_API_KEY=trueand a server-side provider key is configured, client-submittedapiKeyshould be ignored inresolve-model.ts. This requires changes to existing code and is a separate concern. Happy to tackle it as a follow-up if maintainers agree on the approach.Questions for Maintainers
messages/structure? Which locales are required at minimum?openmaic_auth— any naming convention to follow?resolve-model.tschanges?Happy to implement this if the approach looks good.
Related: #287
Beta Was this translation helpful? Give feedback.
All reactions