-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(registration): allow self-hosted users to disable registration altogether #2365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryAdded
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant Browser
participant LoginPage as Login/Signup Page
participant AuthAPI as Auth API Route
participant AuthLib as Auth Library
participant SocketAuth as Socket Auth Middleware
participant V1API as V1 API Routes
participant AnonymousModule as Anonymous Module
participant DB as Database
alt Normal Authentication Flow
User->>Browser: Navigate to /login
Browser->>LoginPage: Load login page
LoginPage->>User: Show login form
User->>AuthAPI: Submit credentials
AuthAPI->>AuthLib: Authenticate
AuthLib->>DB: Verify credentials
DB-->>AuthLib: User data
AuthLib-->>AuthAPI: Session created
AuthAPI-->>Browser: Set session cookie
Browser->>User: Redirect to workspace
end
alt Auth Bypass Mode (isAuthDisabled)
User->>Browser: Navigate to /login
Browser->>LoginPage: Load login page
LoginPage->>LoginPage: Check isAuthDisabled flag
LoginPage->>Browser: Redirect to /workspace
Browser->>AuthAPI: Request session (GET /api/auth/get-session)
AuthAPI->>AuthAPI: Check isAuthDisabled flag
AuthAPI->>AnonymousModule: ensureAnonymousUserExists()
AnonymousModule->>DB: Check for anonymous user
alt Anonymous user doesn't exist
AnonymousModule->>DB: INSERT anonymous user (id: 00000000...)
end
AnonymousModule-->>AuthAPI: User exists
AuthAPI->>AnonymousModule: createAnonymousSession()
AnonymousModule-->>AuthAPI: Anonymous session object
AuthAPI-->>Browser: Return anonymous session
Browser->>User: Display workspace with anonymous user
end
alt Socket.IO Connection (isAuthDisabled)
Browser->>Browser: Request socket token
Browser->>AuthAPI: POST /api/auth/socket-token
AuthAPI->>AuthAPI: Check isAuthDisabled flag
AuthAPI-->>Browser: Return 'anonymous-socket-token'
Browser->>SocketAuth: Connect with token
SocketAuth->>SocketAuth: Check isAuthDisabled flag
SocketAuth->>SocketAuth: Set userId to ANONYMOUS_USER_ID
SocketAuth-->>Browser: Connection established
end
alt V1 API Request (isAuthDisabled)
User->>V1API: API request (no x-api-key header)
V1API->>V1API: authenticateV1Request()
V1API->>V1API: Check isAuthDisabled flag
V1API-->>User: Return authenticated with ANONYMOUS_USER_ID
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
60 files reviewed, no comments
62342f0 to
1ea07a5
Compare
1ea07a5 to
e8e8df3
Compare
Summary
environment.tstofeature-flags.tsand brought in all other server-side feature flags into itFixes #2361
Type of Change
Testing
Tested manually
Checklist