public async Task UpdateSettings(
            IClientRepository repository,
            string clientName,
            string description,
            string clientUri,
            string logoUri,
            bool requireClientSecret,
            bool requireConsent,
            bool alwaysIncludeUserClaimsInIdToken,
            bool allowAccessTokensViaBrowser,
            bool ResourceOwnerEnabled,
            int identityTokenLifetime,
            List <string> redirectUris,
            List <string> allowedCorsOrigins,
            List <string> allowedScopes
            )
        {
            if (!await repository.HasUniqName(clientName, Id))
            {
                throw new ArgumentException("An other tenant has the same name.", nameof(clientName));
            }


            RequireClientSecret = requireClientSecret;
            ClientName          = clientName;
            Description         = description;
            ClientUri           = clientUri;
            LogoUri             = logoUri;
            RequireConsent      = requireConsent;
            AlwaysIncludeUserClaimsInIdToken = alwaysIncludeUserClaimsInIdToken;
            AllowAccessTokensViaBrowser      = allowAccessTokensViaBrowser;
            RedirectUris          = redirectUris;
            AllowedScopes         = allowedScopes;
            AllowedCorsOrigins    = allowedCorsOrigins;
            IdentityTokenLifetime = identityTokenLifetime;
            if (ResourceOwnerEnabled)
            {
                AllowedGrantTypes = AllowedGrantTypes.Concat(IModels.GrantTypes.ResourceOwnerPassword).Distinct().ToList();
            }
            else
            {
                AllowedGrantTypes.RemoveAll(a => IModels.GrantTypes.ResourceOwnerPassword.Any(r => r == a));
            }
        }
Exemple #2
0
 public void RemoveGrantType(string grantType)
 {
     AllowedGrantTypes.RemoveAll(r => r.GrantType == grantType);
 }