graphai.api.auth.auth_utils module

graphai.api.auth.auth_utils.get_ratelimit_values()
class graphai.api.auth.auth_utils.Token(*, access_token: str, token_type: str)

Bases: BaseModel

access_token: str
token_type: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.auth.auth_utils.TokenData(*, username: str | None = None, scopes: List[str] = [])

Bases: BaseModel

username: str | None
scopes: List[str]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.auth.auth_utils.User(*, username: str, email: str | None = None, full_name: str | None = None, scopes: List[str] = [], disabled: bool | None = None)

Bases: BaseModel

username: str
email: str | None
full_name: str | None
scopes: List[str]
disabled: bool | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.auth.auth_utils.UserInDB(*, username: str, email: str | None = None, full_name: str | None = None, scopes: List[str] = [], disabled: bool | None = None, hashed_password: str)

Bases: User

hashed_password: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

graphai.api.auth.auth_utils.generate_random_password_string(length=32)
graphai.api.auth.auth_utils.verify_password(plain_password, hashed_password)
graphai.api.auth.auth_utils.get_password_hash(password)
graphai.api.auth.auth_utils.get_user(username: str)
graphai.api.auth.auth_utils.get_user_ratelimit_overrides(username: str, path: str)
graphai.api.auth.auth_utils.authenticate_user(username: str, password: str)
async graphai.api.auth.auth_utils.extract_username_and_scopes(token)
graphai.api.auth.auth_utils.extract_username_sync(token)
graphai.api.auth.auth_utils.has_rag_access_rights(username, index_name)

Checks to see if a given user has access to a given index for the /rag/retreive endpoint. :param username: Username :param index_name: Name of the index

Returns:

True if the user is granted access or if the access management table has not been set up, False otherwise.