Extracted function to generate authentication tokens for service accounts.
This commit is contained in:
parent
ef2d8d14a0
commit
38df6e873b
@ -221,10 +221,17 @@ def create_service_account(email: str, roles: typing.Iterable, service: dict,
|
|||||||
user.update(result)
|
user.update(result)
|
||||||
|
|
||||||
# Create an authentication token that won't expire for a long time.
|
# Create an authentication token that won't expire for a long time.
|
||||||
token = local_auth.generate_and_store_token(user['_id'], days=36500, prefix=b'SRV')
|
token = generate_auth_token(user['_id'])
|
||||||
|
|
||||||
return user, token
|
return user, token
|
||||||
|
|
||||||
|
|
||||||
|
def generate_auth_token(service_account_id) -> dict:
|
||||||
|
"""Generates an authentication token for a service account."""
|
||||||
|
|
||||||
|
token_info = local_auth.generate_and_store_token(service_account_id, days=36500, prefix=b'SRV')
|
||||||
|
return token_info
|
||||||
|
|
||||||
|
|
||||||
def setup_app(app, api_prefix):
|
def setup_app(app, api_prefix):
|
||||||
app.register_api_blueprint(blueprint, url_prefix=api_prefix)
|
app.register_api_blueprint(blueprint, url_prefix=api_prefix)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user