feat(auth): add secure configuration and environment support
This commit is contained in:
parent
56df3228a4
commit
6f7cae9e24
5 changed files with 82 additions and 6 deletions
|
|
@ -3,9 +3,10 @@ from datetime import UTC, datetime, timedelta
|
|||
from jose import jwt
|
||||
from pwdlib import PasswordHash
|
||||
|
||||
from app.core.config import settings
|
||||
|
||||
password_hash = PasswordHash.recommended()
|
||||
|
||||
SECRET_KEY = "CHANGE_ME"
|
||||
ALGORITHM = "HS256"
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES = 60
|
||||
|
||||
|
|
@ -26,4 +27,8 @@ def create_access_token(subject: str) -> str:
|
|||
"exp": expire,
|
||||
}
|
||||
|
||||
return jwt.encode(payload, SECRET_KEY, algorithm=ALGORITHM)
|
||||
return jwt.encode(
|
||||
payload,
|
||||
settings.secret_key,
|
||||
algorithm=ALGORITHM,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue