Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OpenAPI generation for NoAuthAuthentication #64

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions plugins/auth/fps_auth/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import httpx
from fastapi import Depends, status
from fastapi.security.base import SecurityBase
from fastapi_users.authentication import BaseAuthentication, CookieAuthentication # type: ignore
from fastapi_users import FastAPIUsers, BaseUserManager # type: ignore
from starlette.requests import Request
Expand All @@ -25,16 +24,11 @@
)


class NoAuth(SecurityBase):
def __call__(self):
return "noauth"


class NoAuthAuthentication(BaseAuthentication):
def __init__(self, user: UserDB, name: str = "noauth"):
super().__init__(name, logout=False)
self.user = user
self.scheme = NoAuth()
self.scheme = None # type: ignore

async def __call__(self, credentials, user_manager):
noauth_user = await user_manager.user_db.get_by_email(NOAUTH_EMAIL)
Expand Down