Skip to content

Conversation

@hrideshmg
Copy link
Member

Refer to docs/auth.md for more details.

@hrideshmg hrideshmg changed the title Implement OAuth Authentication + Role Based Access Control (RBAC) into Root. Implement OAuth Authentication + Role Based Access Control (RBAC) for Root. Nov 17, 2025
@hrideshmg hrideshmg requested a review from Copilot November 17, 2025 19:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a comprehensive OAuth-based authentication system with role-based access control (RBAC) for the Root backend. The implementation adds GitHub OAuth for user authentication, session management for maintaining logged-in state, API key authentication for bot accounts, and role-based guards to protect GraphQL mutations.

Key Changes:

  • Added GitHub OAuth flow for user registration and login with organization membership verification
  • Implemented session-based authentication with 30-day expiration and daily cleanup task
  • Created API key system for bot authentication with bcrypt-hashed keys
  • Added role-based access control with Admin, Member, and Bot roles enforced via GraphQL guards

Reviewed Changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 22 comments.

Show a summary per file
File Description
src/auth/* New authentication module with OAuth, session, API key services, middleware, and guards
src/routes.rs Added OAuth endpoints and custom GraphQL handler with auth context injection
src/graphql/mutations/auth_mutations.rs New authentication mutations for OAuth callback, logout, and bot management
src/graphql/mutations/*.rs Applied role-based guards to existing mutations (attendance, member, status)
src/models/auth.rs New authentication models for roles, sessions, API keys, and responses
src/models/member.rs Updated Member model to support nullable fields and role column
migrations/20251114165724_create_auth_system.sql Database schema changes for auth tables and Member modifications
docs/auth.md Comprehensive authentication system documentation
Cargo.toml Added dependencies for OAuth2, bcrypt, and rand
.env.sample Added GitHub OAuth configuration variables

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hrideshmg hrideshmg force-pushed the auth_claude branch 2 times, most recently from 7c7f86a to a11ebd6 Compare November 21, 2025 17:55
@hrideshmg hrideshmg merged commit 63f0e50 into amfoss:develop Nov 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant