-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: Move auth constants to separate file
This simplifies avoiding circular imports when trying to use auth handlers.
- Loading branch information
1 parent
fb02db6
commit 865370e
Showing
21 changed files
with
78 additions
and
77 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import enum | ||
from datetime import timedelta | ||
from typing import Final | ||
|
||
ALGORITHM: Final = "HS256" | ||
DEFAULT_OAUTH_TOKEN_EXPIRY: Final = timedelta(minutes=15) | ||
|
||
|
||
class Scope(enum.StrEnum): | ||
ME_READ = "me.read" | ||
ME_WRITE = "me.write" | ||
ROMS_READ = "roms.read" | ||
ROMS_WRITE = "roms.write" | ||
ROMS_USER_READ = "roms.user.read" | ||
ROMS_USER_WRITE = "roms.user.write" | ||
PLATFORMS_READ = "platforms.read" | ||
PLATFORMS_WRITE = "platforms.write" | ||
ASSETS_READ = "assets.read" | ||
ASSETS_WRITE = "assets.write" | ||
FIRMWARE_READ = "firmware.read" | ||
FIRMWARE_WRITE = "firmware.write" | ||
COLLECTIONS_READ = "collections.read" | ||
COLLECTIONS_WRITE = "collections.write" | ||
USERS_READ = "users.read" | ||
USERS_WRITE = "users.write" | ||
TASKS_RUN = "tasks.run" | ||
|
||
|
||
DEFAULT_SCOPES_MAP: Final = { | ||
Scope.ME_READ: "View your profile", | ||
Scope.ME_WRITE: "Modify your profile", | ||
Scope.ROMS_READ: "View ROMs", | ||
Scope.PLATFORMS_READ: "View platforms", | ||
Scope.ASSETS_READ: "View assets", | ||
Scope.ASSETS_WRITE: "Modify assets", | ||
Scope.FIRMWARE_READ: "View firmware", | ||
Scope.ROMS_USER_READ: "View user-rom properties", | ||
Scope.ROMS_USER_WRITE: "Modify user-rom properties", | ||
Scope.COLLECTIONS_READ: "View collections", | ||
Scope.COLLECTIONS_WRITE: "Modify collections", | ||
} | ||
|
||
WRITE_SCOPES_MAP: Final = { | ||
Scope.ROMS_WRITE: "Modify ROMs", | ||
Scope.PLATFORMS_WRITE: "Modify platforms", | ||
Scope.FIRMWARE_WRITE: "Modify firmware", | ||
} | ||
|
||
FULL_SCOPES_MAP: Final = { | ||
Scope.USERS_READ: "View users", | ||
Scope.USERS_WRITE: "Modify users", | ||
Scope.TASKS_RUN: "Run tasks", | ||
} | ||
|
||
DEFAULT_SCOPES: Final = list(DEFAULT_SCOPES_MAP.keys()) | ||
WRITE_SCOPES: Final = DEFAULT_SCOPES + list(WRITE_SCOPES_MAP.keys()) | ||
FULL_SCOPES: Final = WRITE_SCOPES + list(FULL_SCOPES_MAP.keys()) |
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
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
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
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