File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212import database
1313from auth import crud
1414from auth .models import LoginBodyModel
15- from constants import IS_PROD
15+ from constants import DOMAIN , IS_PROD , SAMESITE
1616from utils .shared_models import DetailModel
1717
1818_logger = logging .getLogger (__name__ )
@@ -40,7 +40,7 @@ def generate_session_id_b64(num_bytes: int) -> str:
4040 "/login" ,
4141 description = "Create a login session." ,
4242 response_description = "Successfully validated with SFU's CAS" ,
43- response_model = None ,
43+ response_model = str ,
4444 responses = {
4545 307 : { "description" : "Successful validation, with redirect" },
4646 400 : { "description" : "Origin is missing." , "model" : DetailModel },
@@ -87,8 +87,8 @@ async def login_user(
8787 value = session_id ,
8888 secure = IS_PROD ,
8989 httponly = True ,
90- samesite = None if IS_PROD else "lax" ,
91- domain = ".sfucsss.org" if IS_PROD else None
90+ samesite = SAMESITE ,
91+ domain = DOMAIN
9292 ) # this overwrites any past, possibly invalid, session_id
9393 return response
9494
Original file line number Diff line number Diff line change 2626
2727# https://docs.github.com/en/enterprise-server@3.10/admin/identity-and-access-management/iam-configuration-reference/username-considerations-for-external-authentication
2828GITHUB_USERNAME_LEN = 39
29+
30+ # COOKIE
31+ SAMESITE = None if IS_PROD else "lax"
32+ DOMAIN = ".sfucsss.org" if IS_PROD else None
Original file line number Diff line number Diff line change 2020if not IS_PROD :
2121 print ("Running local environment" )
2222 origins = [
23- "http://localhost:* " , # default Angular
23+ "http://localhost:4200 " , # default Angular
2424 "http://localhost:8080" , # for existing applications/sites
2525 ]
2626 app = FastAPI (
You can’t perform that action at this time.
0 commit comments