-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
40 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from fastapi import APIRouter, Response | ||
|
||
from server.routers.auth import REFRESH_TOKEN_COOKIE, IdentityPayload, insert_new_guest_user | ||
from server.routers.utility.sessions.interface import setup_new_guest_session | ||
from server.routers.utility.sessions.middleware import set_secure_cookie | ||
|
||
|
||
router = APIRouter( | ||
prefix="/dev", | ||
tags=["dev"], | ||
) | ||
|
||
@router.post('/guest_login') | ||
def create_guest_session(res: Response) -> IdentityPayload: | ||
# create new login session for user in db, generating new tokens | ||
uid = insert_new_guest_user() | ||
new_session_token, session_expiry, new_refresh_token, refresh_expiry = setup_new_guest_session(uid) | ||
|
||
# TODO-OLLI(pm): setting up proper logging | ||
|
||
# set the cookies and return the identity | ||
set_secure_cookie(res, REFRESH_TOKEN_COOKIE, new_refresh_token, refresh_expiry) | ||
return IdentityPayload(session_token=new_session_token, exp=session_expiry, uid=uid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters