feat: enhance authentication and publication download tracking
- Added JWT authentication support with configurable secret and expiration. - Introduced optional API key validation for endpoints. - Implemented tracking of publication downloads by researchers, storing records in a new PublicationDownload model. - Updated export endpoints to conditionally register downloads based on user authentication. - Enhanced researcher search response to indicate if publications were downloaded by the current user. - Updated environment configuration to include new JWT settings.
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class OrcidLoginRequestSchema(BaseModel):
|
||||
# `code` is the authorization code returned by ORCID OAuth after the user signs in.
|
||||
# Exchanging it for tokens must happen server-side.
|
||||
code: str = Field(..., examples=["Q70Y3A"])
|
||||
|
||||
|
||||
class OrcidLoginResponseSchema(BaseModel):
|
||||
access_token: str
|
||||
token_type: str = "bearer"
|
||||
@@ -25,6 +25,5 @@ class PublicationSchema(BaseModel):
|
||||
hash_fingerprint: str | None = None
|
||||
last_modified: datetime | None = None
|
||||
status: str | None = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
downloaded_by_me: bool | None = None
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
Reference in New Issue
Block a user