Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
419598220a | ||
|
|
565dc5f710 |
+4
-3
@@ -3,9 +3,10 @@
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
import jwt
|
||||||
from fastapi import Depends, HTTPException, status
|
from fastapi import Depends, HTTPException, status
|
||||||
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
||||||
from jose import JWTError, jwt
|
from jwt import PyJWTError
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from app.database import get_db
|
from app.database import get_db
|
||||||
@@ -56,7 +57,7 @@ def verify_mfa_token(token: str) -> str:
|
|||||||
detail="Invalid MFA token.",
|
detail="Invalid MFA token.",
|
||||||
)
|
)
|
||||||
return username
|
return username
|
||||||
except JWTError:
|
except PyJWTError:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
detail="MFA token expired or invalid.",
|
detail="MFA token expired or invalid.",
|
||||||
@@ -95,7 +96,7 @@ def get_current_user(
|
|||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
detail="Invalid token payload.",
|
detail="Invalid token payload.",
|
||||||
)
|
)
|
||||||
except JWTError:
|
except PyJWTError:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
detail="Invalid or expired token.",
|
detail="Invalid or expired token.",
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ logger = logging.getLogger(__name__)
|
|||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title="NetBird MSP Appliance",
|
title="NetBird MSP Appliance",
|
||||||
description="Multi-tenant NetBird management platform for MSPs",
|
description="Multi-tenant NetBird management platform for MSPs",
|
||||||
version="1.6.1",
|
version="1.6.2",
|
||||||
docs_url="/api/docs",
|
docs_url="/api/docs",
|
||||||
redoc_url="/api/redoc",
|
redoc_url="/api/redoc",
|
||||||
openapi_url="/api/openapi.json",
|
openapi_url="/api/openapi.json",
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ sqlalchemy==2.0.23
|
|||||||
aiosqlite==0.19.0
|
aiosqlite==0.19.0
|
||||||
pydantic==2.5.2
|
pydantic==2.5.2
|
||||||
pydantic-settings==2.1.0
|
pydantic-settings==2.1.0
|
||||||
python-jose[cryptography]==3.4.0
|
PyJWT==2.15.1
|
||||||
passlib[bcrypt]==1.7.4
|
passlib[bcrypt]==1.7.4
|
||||||
bcrypt==4.1.2
|
bcrypt==4.1.2
|
||||||
cryptography==50.0.0
|
cryptography==50.0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user