diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 487e3754a..39f865915 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -106,14 +106,14 @@ $ pip install -r requirements.txt # Install additional tools and dependencies We use [pylint](https://pylint.org/) for verifying source code format, and enforcing other Python programming best practices. -There is a pylint configuration file ([`.pylintrc`](../.pylintrc)) at the root of this Git +There is a pylint configuration file ([`.pylintrc`](.pylintrc)) at the root of this Git repository. This enables you to invoke pylint directly from the command line: ``` pylint firebase_admin ``` -However, it is recommended that you use the [`lint.sh`](../lint.sh) bash script to invoke +However, it is recommended that you use the [`lint.sh`](lint.sh) bash script to invoke pylint. This script will run the linter on both `firebase_admin` and the corresponding `tests` module. It suprresses some of the noisy warnings that get generated when running pylint on test code. Note that by default `lint.sh` will only @@ -226,7 +226,7 @@ pyenv install 3.3.0 # install Python 3.3.0 pyenv install pypy2-5.6.0 # install pypy2 ``` -Refer to the [`tox.ini`](../tox.ini) file for a list of target environments that we usually test. +Refer to the [`tox.ini`](tox.ini) file for a list of target environments that we usually test. Use pyenv to install all the required Python versions on your workstation. Verify that they are installed by running the following command: diff --git a/firebase_admin/auth.py b/firebase_admin/auth.py index 984c2babd..4f3d34b0b 100644 --- a/firebase_admin/auth.py +++ b/firebase_admin/auth.py @@ -121,6 +121,7 @@ def create_custom_token(uid, developer_claims=None, app=None): except _token_gen.ApiCallError as error: raise AuthError(error.code, str(error), error.detail) + def verify_id_token(id_token, app=None, check_revoked=False): """Verifies the signature and data for the provided JWT. @@ -150,6 +151,7 @@ def verify_id_token(id_token, app=None, check_revoked=False): _check_jwt_revoked(verified_claims, _ID_TOKEN_REVOKED, 'ID token', app) return verified_claims + def create_session_cookie(id_token, expires_in, app=None): """Creates a new Firebase session cookie from the given ID token and options. @@ -174,6 +176,7 @@ def create_session_cookie(id_token, expires_in, app=None): except _token_gen.ApiCallError as error: raise AuthError(error.code, str(error), error.detail) + def verify_session_cookie(session_cookie, check_revoked=False, app=None): """Verifies a Firebase session cookie. @@ -199,6 +202,7 @@ def verify_session_cookie(session_cookie, check_revoked=False, app=None): _check_jwt_revoked(verified_claims, _SESSION_COOKIE_REVOKED, 'session cookie', app) return verified_claims + def revoke_refresh_tokens(uid, app=None): """Revokes all refresh tokens for an existing user. @@ -214,6 +218,7 @@ def revoke_refresh_tokens(uid, app=None): user_manager = _get_auth_service(app).user_manager user_manager.update_user(uid, valid_since=int(time.time())) + def get_user(uid, app=None): """Gets the user data corresponding to the specified user ID. @@ -236,6 +241,7 @@ def get_user(uid, app=None): except _user_mgt.ApiCallError as error: raise AuthError(error.code, str(error), error.detail) + def get_user_by_email(email, app=None): """Gets the user data corresponding to the specified user email. @@ -281,6 +287,7 @@ def get_user_by_phone_number(phone_number, app=None): except _user_mgt.ApiCallError as error: raise AuthError(error.code, str(error), error.detail) + def list_users(page_token=None, max_results=_user_mgt.MAX_LIST_USERS_RESULTS, app=None): """Retrieves a page of user accounts from a Firebase project. @@ -381,6 +388,7 @@ def update_user(uid, **kwargs): except _user_mgt.ApiCallError as error: raise AuthError(error.code, str(error), error.detail) + def set_custom_user_claims(uid, custom_claims, app=None): """Sets additional claims on an existing user account. @@ -407,6 +415,7 @@ def set_custom_user_claims(uid, custom_claims, app=None): except _user_mgt.ApiCallError as error: raise AuthError(error.code, str(error), error.detail) + def delete_user(uid, app=None): """Deletes the user identified by the specified user ID. @@ -424,6 +433,7 @@ def delete_user(uid, app=None): except _user_mgt.ApiCallError as error: raise AuthError(error.code, str(error), error.detail) + def import_users(users, hash_alg=None, app=None): """Imports the specified list of users into Firebase Auth. @@ -453,6 +463,7 @@ def import_users(users, hash_alg=None, app=None): except _user_mgt.ApiCallError as error: raise AuthError(error.code, str(error), error.detail) + def generate_password_reset_link(email, action_code_settings=None, app=None): """Generates the out-of-band email action link for password reset flows for the specified email address. @@ -477,6 +488,7 @@ def generate_password_reset_link(email, action_code_settings=None, app=None): except _user_mgt.ApiCallError as error: raise AuthError(error.code, str(error), error.detail) + def generate_email_verification_link(email, action_code_settings=None, app=None): """Generates the out-of-band email action link for email verification flows for the specified email address. @@ -501,6 +513,7 @@ def generate_email_verification_link(email, action_code_settings=None, app=None) except _user_mgt.ApiCallError as error: raise AuthError(error.code, str(error), error.detail) + def generate_sign_in_with_email_link(email, action_code_settings, app=None): """Generates the out-of-band email action link for email link sign-in flows, using the action code settings provided. @@ -525,6 +538,7 @@ def generate_sign_in_with_email_link(email, action_code_settings, app=None): except _user_mgt.ApiCallError as error: raise AuthError(error.code, str(error), error.detail) + def _check_jwt_revoked(verified_claims, error_code, label, app): user = get_user(verified_claims.get('uid'), app=app) if verified_claims.get('iat') * 1000 < user.tokens_valid_after_timestamp: