Added PostgreSQL RDS database. Added channels protected endpoints. Added scripts and docker config to run application locally in dev mode.
Some checks failed
AWS Deploy on Push / build (push) Failing after 41s
Some checks failed
AWS Deploy on Push / build (push) Failing after 41s
This commit is contained in:
32
app/auth/mock_auth.py
Normal file
32
app/auth/mock_auth.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from fastapi import HTTPException, status
|
||||
from app.models.auth import CognitoUser
|
||||
|
||||
MOCK_USERS = {
|
||||
"testuser": {
|
||||
"username": "testuser",
|
||||
"roles": ["admin"]
|
||||
}
|
||||
}
|
||||
|
||||
def mock_get_user_from_token(token: str) -> CognitoUser:
|
||||
"""
|
||||
Mock version of get_user_from_token for local testing
|
||||
Accepts 'testuser' as a valid token and returns admin user
|
||||
"""
|
||||
if token == "testuser":
|
||||
return CognitoUser(**MOCK_USERS["testuser"])
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail="Invalid mock token - use 'testuser'"
|
||||
)
|
||||
|
||||
def mock_initiate_auth(username: str, password: str) -> dict:
|
||||
"""
|
||||
Mock version of initiate_auth for local testing
|
||||
Accepts any username/password and returns a mock token
|
||||
"""
|
||||
return {
|
||||
"AccessToken": "testuser",
|
||||
"ExpiresIn": 3600,
|
||||
"TokenType": "Bearer"
|
||||
}
|
||||
Reference in New Issue
Block a user