(data: dict, expires_delta: timedelta = None)
| 37 | |
| 38 | # Create an access token |
| 39 | def create_access_token(data: dict, expires_delta: timedelta = None): |
| 40 | to_encode = data.copy() |
| 41 | if expires_delta: |
| 42 | expire = datetime.utcnow() + expires_delta |
| 43 | else: |
| 44 | expire = datetime.utcnow() + timedelta(minutes=15) |
| 45 | to_encode.update({"exp": expire}) |
| 46 | encoded_jwt = jwt.encode(to_encode, AppConfig.SECRET_KEY, algorithm=AppConfig.ALGORITHM) |
| 47 | return encoded_jwt |
| 48 | |
| 49 | # Authenticate a user (This function might need the get_user_from_db function, which should be imported from user_management.py) |
| 50 | def authenticate_user(username: str, password: str): |
no outgoing calls
no test coverage detected