Beispiel #1
0
        public async Task EnsureScopesPresent(params string[] scopeNames)
        {
            var scopes = scopeNames.Select(CreateResourceScope).ToList();

            scopes.AddRange(IdentityScopes.Select(CreateIdentityScope));


            foreach (var scope in scopes)
            {
                var exists = await _securityRepository.Exists <Scope>(c => c.Name == scope.Name);

                if (exists)
                {
                    Log(true, nameof(Scope), scope.Name);
                }
                else
                {
                    Log(false, nameof(Scope), scope.Name);
                    await _securityRepository.AddScope(scope);
                }
            }
        }