feat(scope for credentials session): add scope to import script

This commit is contained in:
Benoit Suttor 2021-09-15 11:38:09 +02:00
parent a91911e1c4
commit e4319193e4
1 changed files with 5 additions and 1 deletions

View File

@ -95,7 +95,8 @@ class Command(BaseCommand):
def do(self, contents):
for content in contents:
locality = content.get(
"locality", {"name": "Collectivité par défaut", "slug": "default"},
"locality",
{"name": "Collectivité par défaut", "slug": "default"},
)
self.info("Locality %s" % locality["name"], ending=" ")
@ -143,6 +144,7 @@ class Command(BaseCommand):
idtoken_algo = getattr(
OIDCClient, "ALGO_" + service["idtoken_algo"].upper()
)
scope = service.get("scope", None)
oidc_client, created = OIDCClient.objects.get_or_create(
slug=service["slug"],
@ -159,6 +161,7 @@ class Command(BaseCommand):
"has_api_access": has_api_access,
"identifier_policy": identifier_policy,
"idtoken_algo": idtoken_algo,
"scope": scope,
},
)
services[slug] = {"oidc_client": oidc_client}
@ -174,6 +177,7 @@ class Command(BaseCommand):
"has_api_access",
"idtoken_algo",
"identifier_policy",
"scope",
):
value = locals()[key]
if value is None: