Skip to content
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

Implement guest authentication with passphrases #92

Merged
merged 10 commits into from
Dec 16, 2023
Merged

Conversation

taesungh
Copy link
Member

@taesungh taesungh commented Dec 16, 2023

Add API routes and handlers for guest authentication. We currently don't have the frontend interface for guest login, so the authentication flow was tested manually with the FastAPI Swagger Docs and POST requests with curl.

Code Changes

  • Import guest authentication code from last year
  • Fix EmailStr usage in test_guest_auth
  • Replace references to hackuci with irvinehacks
  • Use annotated FastAPI parameters in guest router
  • Check for AUTH_KEY_SALT environment at runtime
    • Raise RuntimeError if AUTH_KEY_SALT environment variable is not provided to Vercel Serverless runtime
    • Reorganize environment variable usage and include note in API README
  • Include guest router in app
  • Clean up token expiration and fix unit test
  • Temporarily replace guest token email with print
  • Allow non-edu email in guest authentication flow
    • For IrvineHacks 2024, we are allowing high school students (18+) who would not have .edu email addresses
  • Resolve Pydantic deprecation warning in GuestAuth
    • Replace parse_obj with model_validate

Deployment Changes

  • Added AUTH_KEY_SALT to Vercel deployments
  • Populated DB.settings.word_list with random word list

Testing

  1. Run Docker compose for API
  2. Add entries to the word list document through the Mongo Express interface at http://localhost:8081
  3. Open the API docs at http://localhost:8000/docs
  4. Try completing the guest authentication flow starting with /guest/login and then /guest/verify
    • The login token will be printed in the console instead of emailed
    • Note some of the requests are better done in curl to see the entire response headers

- Import `guest` router and `guest_auth` component from last year's
  HackAtUCI/HackUCI-Site repository as is
- Raise `RuntimeError` if `AUTH_KEY_SALT` environment variable is not
  provided to Vercel Serverless runtime
- Reorganize environment variable usage and include note in API README
Copy link
Contributor

github-actions bot commented Dec 16, 2023

Deploy preview for irvinehacks-site-2024 ready!

Name IrvineHacks 2024 Site
Preview Visit Preview
Commit 7297334

Copy link
Contributor

github-actions bot commented Dec 16, 2023

Deploy preview for irvinehacks-site-2024-sanity ready!

Name Sanity Studio
Preview Visit Preview
Commit 7297334

@taesungh taesungh changed the title Feature/guest auth Implement guest authentication with passphrases Dec 16, 2023
- For IrvineHacks 2024, we are allowing high school students (18+) who
  would not have .edu email addresses
- Replace `parse_obj` with `model_validate`
@taesungh
Copy link
Member Author

Confirmed functional through /api/docs on the preview deployment and looking at the passphrase on the Vercel deployment logs.

@taesungh taesungh merged commit 103c95e into main Dec 16, 2023
4 checks passed
This was referenced Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants