-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba6a2ba
commit 9431b94
Showing
2 changed files
with
21 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,14 @@ | |
from .db import secret, get_user_db | ||
|
||
|
||
NOAUTH_EMAIL = "[email protected]" | ||
NOAUTH_USER = UserDB( | ||
id="d4ded46b-a4df-4b51-8d83-ae19010272a7", | ||
email=NOAUTH_EMAIL, | ||
hashed_password="", | ||
) | ||
|
||
|
||
class NoAuth(SecurityBase): | ||
def __call__(self): | ||
return "noauth" | ||
|
@@ -29,13 +37,11 @@ def __init__(self, user: UserDB, name: str = "noauth"): | |
self.scheme = NoAuth() | ||
|
||
async def __call__(self, credentials, user_manager): | ||
# always return the user no matter what | ||
return self.user | ||
noauth_user = await user_manager.user_db.get_by_email(NOAUTH_EMAIL) | ||
return noauth_user or self.user | ||
|
||
|
||
noauth_email = "[email protected]" | ||
noauth_user = UserDB(email=noauth_email, hashed_password="") | ||
noauth_authentication = NoAuthAuthentication(noauth_user) | ||
noauth_authentication = NoAuthAuthentication(NOAUTH_USER) | ||
|
||
|
||
class UserManager(BaseUserManager[UserCreate, UserDB]): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters