Пример #1
0
        public async Task <object> GetValue(ProviderInstanceProperty property)
        {
            object value = await encryptionService.Decrypt <object>(property.Value);

            switch (property.Property.Type)
            {
            case PropertyType.Authentication:
                ((dynamic)value).SetLoadMethod((Func <int, Task <object> >)GetAuthenticatedSessionClient);
                break;
            }

            List <ProviderPropertyAttribute> attributes = property?.Property?.Attributes ?? new List <ProviderPropertyAttribute>();

            if (attributes.Any(a => a.Name == PropertyAttribute.Transform))
            {
                switch (property.Property.Type)
                {
                case PropertyType.String:
                    value = TransformString(value);
                    break;
                }
            }

            return(value);
        }
Пример #2
0
        public async Task <ProviderInstance> CreateProviderInstance(Provider provider, CreateProviderModel createProviderModel)
        {
            ProviderInstance backupProvider = new ProviderInstance();

            backupProvider.Provider = provider;
            foreach (var property in createProviderModel.Properties)
            {
                ProviderInstanceProperty instanceProperty = new ProviderInstanceProperty();
                instanceProperty.Property = provider.Properties.FirstOrDefault(p => p.Name == property.Name);
                instanceProperty.Value    = await Parse(property.Value.ToString(), instanceProperty.Property.Type, instanceProperty.Property.Attributes);

                backupProvider.Values.Add(instanceProperty);
            }
            return(backupProvider);
        }
        public async Task <ProviderInstance> CreateProviderInstance(Provider provider, Dictionary <string, string> properties)
        {
            ProviderInstance backupProvider = new ProviderInstance();

            backupProvider.Provider = provider;
            foreach (var property in provider.Properties)
            {
                string value = properties.ContainsKey(property.TypeName) ? properties[property.TypeName] : null;

                ProviderInstanceProperty instanceProperty = new ProviderInstanceProperty();
                instanceProperty.Property = property;
                instanceProperty.Value    = await Parse(value, property.Type, property.Attributes);

                backupProvider.Values.Add(instanceProperty);
            }
            return(backupProvider);
        }
Пример #4
0
 public async Task <object> GetPresentationValue(ProviderInstanceProperty property)
 {
     return(await encryptionService.Decrypt <object>(property.Value));
 }