Skip to content

Conversation

@micahdbak
Copy link
Collaborator

@micahdbak micahdbak commented Sep 25, 2024

Description

Some upgrades for the auth module, considering new endpoint at /api instead of api.sfucsss.org

Changes

  • Rename user_info to get_user_info
  • Remove check_user_session crud function since get_user_info acts as a session validator anyways
  • Add update_user_info crud function
  • Add "profile_picture_url" column to site user (auth) table as example column for updating
  • Rename "root_ip_address" to "CURRENT_ENDPOINT" in constants
    • Now is set using new routing scheme of /api not api.sfucsss.org
  • New auth routes:
    • GET /api/auth/login?path={path}&fragment={fragment}&ticket={ticket}
      • should be called by SFU CAS, after successfully logging in
      • redirects to (CURRENT_ENDPOINT)(path)#(fragment) when site user is logged in
      • sets the session_id cookie
    • GET /api/auth/logout
      • logs out the user, and deletes their session_id cookie
    • GET /api/auth/get_user
      • returns information about the logged in user, or 401 (unauthorized) if not logged in
    • POST /api/auth/update_user (with profile_picture_url set in body of request)
      • updates user information

@micahdbak
Copy link
Collaborator Author

@EarthenSky this PR needs the alembic migrations to be fixed, would you be able to open a PR for that 🥺

also, I'm gonna add some test HTML files, but am gonna wait for alembic to not be f'ed so i can run this locally

@micahdbak
Copy link
Collaborator Author

@EarthenSky pls review 😋 if u can

otherwise ill merge after we meet next

@micahdbak
Copy link
Collaborator Author

(i.e. after alembic stuff is fixed)

Copy link
Collaborator

@EarthenSky EarthenSky left a comment

Choose a reason for hiding this comment

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

Looks good! A few important changes, a few unimportant changes.

Have you tested running login.html yet? If not (due to alembic not working), then please do so now. However, you should be able to test without using alembic using the test database, which gets filled with new data using load_test_db.py (no need for running the migrations)

@micahdbak micahdbak force-pushed the mdb-auth-upgrades branch 4 times, most recently from 5089038 to 6883469 Compare October 5, 2024 01:01
Copy link
Collaborator

@EarthenSky EarthenSky left a comment

Choose a reason for hiding this comment

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

Just ensure the alembic migration is checked, then this looks good!

Oh, also POST logout.

@micahdbak
Copy link
Collaborator Author

@EarthenSky sorry for late reply, was busy this weekend with a Weezer concert and stormhacks - I did run the migrations locally and everything worked well! ++ Ran with the test HTML page

Could you pretty please reply to my comments 🥺 - gracias sir

@EarthenSky
Copy link
Collaborator

tested that it seems to be working okay!

@EarthenSky EarthenSky merged commit efe6e59 into main Oct 17, 2024
2 checks passed
@EarthenSky EarthenSky deleted the mdb-auth-upgrades branch October 17, 2024 07:08
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.

3 participants