fix: delete origins
This commit is contained in:
@@ -57,6 +57,8 @@ class Settings(BaseSettings):
|
|||||||
CSRF_COOKIE_PATH: str = '/'
|
CSRF_COOKIE_PATH: str = '/'
|
||||||
CSRF_COOKIE_DOMAIN: str | None = None
|
CSRF_COOKIE_DOMAIN: str | None = None
|
||||||
|
|
||||||
|
AUTH_COOKIE_SECURE: bool = False
|
||||||
|
|
||||||
DOCS_USERNAME: str = 'admin'
|
DOCS_USERNAME: str = 'admin'
|
||||||
DOCS_PASSWORD: str = 'admin'
|
DOCS_PASSWORD: str = 'admin'
|
||||||
|
|
||||||
@@ -81,9 +83,6 @@ class Settings(BaseSettings):
|
|||||||
RABBIT_CONNECT_TIMEOUT: int = 5
|
RABBIT_CONNECT_TIMEOUT: int = 5
|
||||||
RABBIT_EMAIL_CODE_QUEUE: str = 'email.verification_code'
|
RABBIT_EMAIL_CODE_QUEUE: str = 'email.verification_code'
|
||||||
|
|
||||||
CORS_ORIGINS: str = 'http://localhost:3000'
|
|
||||||
CORS_ALLOW_CREDENTIALS: bool = True
|
|
||||||
|
|
||||||
RATE_LIMIT_REQUESTS: int = 60
|
RATE_LIMIT_REQUESTS: int = 60
|
||||||
RATE_LIMIT_WINDOW: int = 60
|
RATE_LIMIT_WINDOW: int = 60
|
||||||
|
|
||||||
@@ -245,10 +244,6 @@ class Settings(BaseSettings):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def cors_origins_list(self) -> List[str]:
|
|
||||||
return [o.strip() for o in self.CORS_ORIGINS.split(',') if o.strip()]
|
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def DATABASE_URL(self) -> str:
|
def DATABASE_URL(self) -> str:
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -117,8 +117,8 @@ app.add_middleware(
|
|||||||
|
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=settings.cors_origins_list(),
|
allow_origin_regex=r'https?://.+',
|
||||||
allow_credentials=settings.CORS_ALLOW_CREDENTIALS,
|
allow_credentials=True,
|
||||||
allow_methods=['*'],
|
allow_methods=['*'],
|
||||||
allow_headers=['*'],
|
allow_headers=['*'],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ async def registration(
|
|||||||
key='device_id',
|
key='device_id',
|
||||||
value=device_id,
|
value=device_id,
|
||||||
httponly=True,
|
httponly=True,
|
||||||
secure=True,
|
secure=settings.AUTH_COOKIE_SECURE,
|
||||||
samesite='lax',
|
samesite='lax',
|
||||||
path='/',
|
path='/',
|
||||||
max_age=60 * 60 * 24 * 365 * 5
|
max_age=60 * 60 * 24 * 365 * 5
|
||||||
@@ -86,7 +86,7 @@ async def registration(
|
|||||||
key='access_token',
|
key='access_token',
|
||||||
value=created.access_token,
|
value=created.access_token,
|
||||||
httponly=True,
|
httponly=True,
|
||||||
secure=True,
|
secure=settings.AUTH_COOKIE_SECURE,
|
||||||
samesite='lax',
|
samesite='lax',
|
||||||
path='/',
|
path='/',
|
||||||
max_age=int(settings.JWT_ACCESS_TTL_SECONDS),
|
max_age=int(settings.JWT_ACCESS_TTL_SECONDS),
|
||||||
@@ -95,7 +95,7 @@ async def registration(
|
|||||||
key='refresh_token',
|
key='refresh_token',
|
||||||
value=created.refresh_token,
|
value=created.refresh_token,
|
||||||
httponly=True,
|
httponly=True,
|
||||||
secure=True,
|
secure=settings.AUTH_COOKIE_SECURE,
|
||||||
samesite='lax',
|
samesite='lax',
|
||||||
path='/',
|
path='/',
|
||||||
max_age=int(settings.JWT_REFRESH_TTL_SECONDS),
|
max_age=int(settings.JWT_REFRESH_TTL_SECONDS),
|
||||||
@@ -167,7 +167,7 @@ async def login(
|
|||||||
key='device_id',
|
key='device_id',
|
||||||
value=device_id,
|
value=device_id,
|
||||||
httponly=True,
|
httponly=True,
|
||||||
secure=True,
|
secure=settings.AUTH_COOKIE_SECURE,
|
||||||
samesite='lax',
|
samesite='lax',
|
||||||
path='/',
|
path='/',
|
||||||
max_age=60 * 60 * 24 * 365 * 5
|
max_age=60 * 60 * 24 * 365 * 5
|
||||||
@@ -177,7 +177,7 @@ async def login(
|
|||||||
key='access_token',
|
key='access_token',
|
||||||
value=dto.access_token,
|
value=dto.access_token,
|
||||||
httponly=True,
|
httponly=True,
|
||||||
secure=True,
|
secure=settings.AUTH_COOKIE_SECURE,
|
||||||
samesite='lax',
|
samesite='lax',
|
||||||
path='/',
|
path='/',
|
||||||
max_age=int(settings.JWT_ACCESS_TTL_SECONDS),
|
max_age=int(settings.JWT_ACCESS_TTL_SECONDS),
|
||||||
@@ -187,7 +187,7 @@ async def login(
|
|||||||
key='refresh_token',
|
key='refresh_token',
|
||||||
value=dto.refresh_token,
|
value=dto.refresh_token,
|
||||||
httponly=True,
|
httponly=True,
|
||||||
secure=True,
|
secure=settings.AUTH_COOKIE_SECURE,
|
||||||
samesite='lax',
|
samesite='lax',
|
||||||
path='/',
|
path='/',
|
||||||
max_age=int(settings.JWT_REFRESH_TTL_SECONDS),
|
max_age=int(settings.JWT_REFRESH_TTL_SECONDS),
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ async def refresh_tokens(
|
|||||||
key='access_token',
|
key='access_token',
|
||||||
value=access,
|
value=access,
|
||||||
httponly=True,
|
httponly=True,
|
||||||
secure=True,
|
secure=settings.AUTH_COOKIE_SECURE,
|
||||||
samesite='lax',
|
samesite='lax',
|
||||||
path='/',
|
path='/',
|
||||||
max_age=int(settings.JWT_ACCESS_TTL_SECONDS),
|
max_age=int(settings.JWT_ACCESS_TTL_SECONDS),
|
||||||
@@ -51,7 +51,7 @@ async def refresh_tokens(
|
|||||||
key='refresh_token',
|
key='refresh_token',
|
||||||
value=refresh,
|
value=refresh,
|
||||||
httponly=True,
|
httponly=True,
|
||||||
secure=True,
|
secure=settings.AUTH_COOKIE_SECURE,
|
||||||
samesite='lax',
|
samesite='lax',
|
||||||
path='/',
|
path='/',
|
||||||
max_age=int(settings.JWT_REFRESH_TTL_SECONDS),
|
max_age=int(settings.JWT_REFRESH_TTL_SECONDS),
|
||||||
|
|||||||
Reference in New Issue
Block a user