private static void SetClientSecret(SetClientResponse clientResponse, SetClientParam param)
        {
            var client = clientResponse.Client;

            Secret clientSecret = null;

            if (!string.IsNullOrEmpty(param.ClientSecret))
            {
                clientSecret = new Secret
                {
                    Value = param.ClientSecret.Sha256()
                };

                clientResponse.Secret = param.ClientSecret;
            }
            else if (clientResponse.Client.RequireClientSecret)
            {
                var(plain, hash) = SecretGenerator.GenerateSharedSecret();
                clientSecret     = new Secret
                {
                    Type        = "SharedSecret",
                    Value       = hash,
                    Description = "SharedSecret for client " + (client.ClientName ?? client.ClientId)
                };

                clientResponse.Secret = plain;
            }

            if (clientSecret != null)
            {
                clientSecret.Type        = "SharedSecret";
                clientSecret.Description = "SharedSecret for client " + (client.ClientName ?? client.ClientId);

                if (client.ClientSecrets == null)
                {
                    client.ClientSecrets = new List <Secret>();
                }
                client.ClientSecrets.Add(clientSecret);
            }
        }