Auth Module =============================== The auth module contains the classes and function related to the authentication of the user. .. _token: Token Class ------------ The UserToken class has the following attributes: - user: {user_id, email: {verified: bool, value: str } - hash: str - expiry: str - name: str - tokenId: str To get the token by using the root_secret_key you can use the ``UserToken.from_root_secret_key()`` function: .. py:function:: UserToken.from_root_secret_key(root_secret_key, client) Return the token object from the root_secret_key. :param root_secret_key: root_secret_key of the user. :param client: token of the user. :type root_secret_key: str :type client: anonymization.client.BaseClient :return: UserToken object :rtype: UserToken To get the token by using the search parameters you can use the ``UserToken.from_search_params()`` function: .. py:function:: UserToken.from_search_params(params, client) Return the list token object from the search parameters. :param params: search parameters of the user. :param client: token of the user. :type params: Dict[str, Any] :type client: anonymization.client.BaseClient :return: UserToken :rtype: List[UserToken] .. _user: User Class ------------ The user class is the main class of the auth module. It contains the information of the user and the methods to authenticate the user. The User class has the following attributes: - name: str - email: {verified: bool, value: str } - role: str - user_id: str - root_secret_key:Optional[str] To login the user you can use the ``User.from_login()`` function: .. py:function:: User.from_login(email, password, client) Return a user object from the login credentials. :param email: email id of the user. :param password: password of the user. :param client: token of the user. :type email: str :type password: str :type client: anonymization.client.BaseClient :return: User object :rtype: User To get the user by its id you can use the ``User.from_user_id()`` function: .. py:function:: User.from_user_id(user_id, client) Return the user object from the user id. :param user_id: id of the user. :param client: token of the user. :type user_id: str :type client: anonymization.client.BaseClient :return: User object :rtype: User