Skip to content

Commit

Permalink
Revert "Add openapi params for fern bearer auth, hide healthcheck fro…
Browse files Browse the repository at this point in the history
…m fern"

This reverts commit 1b5f46f.
  • Loading branch information
nikochiko committed Sep 16, 2024
1 parent d75faec commit 0713227
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions auth/token_authentication.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Any

from fastapi import Request
from fastapi.exceptions import HTTPException
from fastapi.openapi.models import HTTPBase as HTTPBaseModel, SecuritySchemeType
Expand Down Expand Up @@ -57,22 +55,17 @@ class APIAuth(SecurityBase):
### Usage:
```python
api_auth = APIAuth(scheme_name="bearer", description="Bearer $GOOEY_API_KEY")
api_auth = APIAuth(scheme_name="Bearer", description="Bearer $GOOEY_API_KEY")
@app.get("/api/users")
def get_users(authenticated_user: AppUser = Depends(api_auth)):
...
```
"""

def __init__(
self, scheme_name: str, description: str, openapi_extra: dict[str, Any] = None
):
def __init__(self, scheme_name: str, description: str):
self.model = HTTPBaseModel(
type=SecuritySchemeType.http,
scheme=scheme_name,
description=description,
**(openapi_extra or {}),
type=SecuritySchemeType.http, scheme=scheme_name, description=description
)
self.scheme_name = scheme_name
self.description = description
Expand All @@ -95,9 +88,7 @@ def __call__(self, request: Request) -> AppUser:
return authenticate_credentials(auth[1])


auth_scheme = "bearer"
auth_scheme = "Bearer"
api_auth_header = APIAuth(
scheme_name=auth_scheme,
description=f"{auth_scheme} $GOOEY_API_KEY",
openapi_extra={"x-fern-bearer": {"name": "apiKey", "env": "GOOEY_API_KEY"}},
scheme_name=auth_scheme, description=f"{auth_scheme} $GOOEY_API_KEY"
)

0 comments on commit 0713227

Please sign in to comment.