public static IDependencyContainer Register(PublishConfiguration configuration) { var builder = DependencyBuilderFactory.Create(DependencyLibrary.Microsoft); builder.RegisterInstance(ConnectorBuilder.Build(configuration)); builder.RegisterInstance <ILoggingService>(new ConsoleLoggingService()); builder.Register <IScriptBuilder, ScriptBuilder>(); builder.Register <IScriptRunner, ScriptRunner>(); return(builder.Build()); }
private static void SetupConnector(IAppBuilder app) { /* * Create a connector instance using ConnectorBuilder. The call to the LoadConfig() method * will configure the connector using CKFinder configuration options defined in Web.config. */ var connectorFactory = new OwinConnectorFactory(); var connectorBuilder = new ConnectorBuilder(); /* * Create an instance of authenticator implemented in the previous step. */ var customAuthenticator = new CustomCKFinderAuthenticator(); connectorBuilder /* * Provide the global configuration. * * If you installed CKSource.CKFinder.Connector.Config you should load the static configuration * from XML: * connectorBuilder.LoadConfig(); */ .LoadConfig() .SetAuthenticator(customAuthenticator) .SetRequestConfiguration( (request, config) => { // TODO: Do we need EntityFrameworkKeyValueStoreProvider? /* * * If you installed CKSource.CKFinder.Connector.KeyValue.EntityFramework, you may enable caching: * config.SetKeyValueStoreProvider( * new EntityFrameworkKeyValueStoreProvider("CKFinderCacheConnection")); */ config.LoadConfig(); } ); /* * Build the connector middleware. */ var connector = connectorBuilder .Build(connectorFactory); /* * Add the CKFinder connector middleware to the web application pipeline. */ //app.Use(typeof(MyMiddleWare)); app.UseConnector(connector); }
private static void SetupConnector(IAppBuilder app) { var connectorFactory = new OwinConnectorFactory(); var connectorBuilder = new ConnectorBuilder(); var customAuthenticator = new CKFinderAuthenticator(); connectorBuilder .LoadConfig() .SetAuthenticator(customAuthenticator) .SetRequestConfiguration((request, config) => { config.LoadConfig(); }); var connector = connectorBuilder.Build(connectorFactory); app.UseConnector(connector); }
private static void SetupConnector(IAppBuilder app) { /* * Create a connector instance using ConnectorBuilder. The call to the LoadConfig() method * will configure the connector using CKFinder configuration options defined in Web.config. */ var connectorFactory = new OwinConnectorFactory(); var connectorBuilder = new ConnectorBuilder(); /* * Create an instance of authenticator implemented in the previous step. */ var customAuthenticator = new MyAuthenticator(); connectorBuilder /* * Provide the global configuration. * * If you installed CKSource.CKFinder.Connector.Config, you should load the static configuration * from XML: * connectorBuilder.LoadConfig(); */ .SetAuthenticator(customAuthenticator) .LoadConfig() .SetRequestConfiguration( (request, config) => { /* * If you installed CKSource.CKFinder.Connector.Config, you might want to load the static * configuration from XML as a base configuration to modify: */ config.LoadConfig(); /* * Configure settings per request. * * The minimal configuration has to include at least one backend, one resource type * and one ACL rule. * * For example: */ config.AddBackend("default1", new LocalStorage(@"C:\files")); config.AddResourceType("images", builder => builder.SetBackend("default1", "images")); config.AddAclRule(new AclRule( new StringMatcher("*"), new StringMatcher("*"), new StringMatcher("*"), new Dictionary <Permission, PermissionType> { { Permission.All, PermissionType.Allow } })); /* * If you installed CKSource.CKFinder.Connector.KeyValue.FileSystem, you may enable caching: */ var defaultBackend = config.GetBackend("default1"); } ); /* * Build the connector middleware. */ var connector = connectorBuilder .Build(connectorFactory); /* * Add the CKFinder connector middleware to the web application pipeline. */ app.UseConnector(connector); }
private static OwinConnector ConfigureConnector(string rootPath, string key, string value, string host) { var connectorBuilder = new ConnectorBuilder(); connectorBuilder.SetRequestConfiguration((request, config) => { config.AddBackend("CKFinderPrivate", new LocalStorage(rootPath + "/uploads"), null, true); config.AddBackend("default", new LocalStorage(rootPath + "/uploads", host + "/uploads"), null, false); config.SetCheckDoubleExtension(true); config.SetThumbnailBackend("CKFinderPrivate", "thumbs"); config.AddAclRule(new AclRule( new StringMatcher("*"), new StringMatcher("*"), new StringMatcher("*"), new Dictionary <Permission, PermissionType> { { Permission.FolderView, PermissionType.Allow }, { Permission.FolderCreate, PermissionType.Allow }, { Permission.FolderRename, PermissionType.Allow }, { Permission.FolderDelete, PermissionType.Allow }, { Permission.FileView, PermissionType.Allow }, { Permission.FileCreate, PermissionType.Allow }, { Permission.FileRename, PermissionType.Allow }, { Permission.FileDelete, PermissionType.Allow }, { Permission.ImageResize, PermissionType.Allow }, { Permission.ImageResizeCustom, PermissionType.Allow } })); //public SizeAndQuality(int width, int height, ImageQuality quality); ImageQuality(int qualityValue); var thumbSize = new SizeAndQuality[] { new SizeAndQuality(120, 120, new ImageQuality(80)), new SizeAndQuality(250, 250, new ImageQuality(80)), new SizeAndQuality(300, 300, new ImageQuality(80)), new SizeAndQuality(500, 500, new ImageQuality(80)), }; config.SetThumbnailSizes(thumbSize); config.SetMaxImageSize(new Size(1600, 1600)); config.SetImageResizeThreshold(10, 80); config.SetCheckSizeAfterScaling(true); var imagesize = new SizeDefinition[] { new SizeDefinition("small", 480, 320, new ImageQuality(80)), new SizeDefinition("medium", 600, 480, new ImageQuality(80)), new SizeDefinition("large", 800, 600, new ImageQuality(80)), }; config.SetSizeDefinitions(imagesize); config.SetSecureImageUploads(true); config.SetDisallowUnsafeCharacters(false); //config.AddProxyBackend("local", new LocalStorage(@"MyFiles")); config.AddResourceType("Files", resourceBuilder => resourceBuilder.SetBackend("default", "files") .SetHideFoldersMatchers(new StringMatcher[] { new StringMatcher("_thumbs"), new StringMatcher("__thumbs"), new StringMatcher("CVS"), new StringMatcher(".*") }) ); config.AddResourceType("Documents", resourceBuilder => resourceBuilder.SetBackend("default", "documents") .SetAllowedExtensions("7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip".Split(',')) //.SetHideFilesMatchers(new StringMatcher[] { new StringMatcher(".*") }) .SetHideFoldersMatchers(new StringMatcher[] { new StringMatcher("_thumbs"), new StringMatcher("__thumbs"), new StringMatcher("CVS") })); config.AddResourceType("Images", resourceBuilder => resourceBuilder.SetBackend("default", "images") .SetAllowedExtensions("bmp,gif,jpeg,jpg,png".Split(',')) .SetHideFoldersMatchers(new StringMatcher[] { new StringMatcher("_thumbs"), new StringMatcher("__thumbs") }) ); }); connectorBuilder.SetAuthenticator(new AuthenticatorCustomer("*")).SetLicense(key, value); var connect = connectorBuilder.Build(new OwinConnectorFactory()); // connectorBuilder.licenseProvider.SetLicense("engcoo.vn", "W3N3FU2L7E11G871SYL1ARS4162D9"); return(connect); }
private static void SetupConnector(IAppBuilder app) { /* * Create a connector instance using ConnectorBuilder. The call to the LoadConfig() method * will configure the connector using CKFinder configuration options defined in Web.config. */ var connectorFactory = new OwinConnectorFactory(); var connectorBuilder = new ConnectorBuilder(); /* * Create an instance of authenticator implemented in the previous step. */ var customAuthenticator = new CKFinderAuthenticator(); connectorBuilder /* * Provide the global configuration. * * If you installed CKSource.CKFinder.Connector.Config you may load static configuration * from XML: * connectorBuilder.LoadConfig(); */ .SetAuthenticator(customAuthenticator) .SetRequestConfiguration( (request, config) => { var instanceId = request.QueryParameters["id"].FirstOrDefault() ?? string.Empty; //var baseUrl = GetBaseUrlByInstanceId(instanceId); //config.AddProxyBackend("default", new LocalStorage(root)); //config.AddProxyBackend("baseUrl", new LocalStorage(@"\ckfinder\userfiles\")); //config.AddResourceType("images", builder => builder.SetBackend("default", "images" )); config.LoadConfig(); /* * Configure settings per request. * * The minimal configuration has to include at least one backend, one resource type * and one ACL rule. * * For example: * config.AddBackend("default", new LocalStorage(@"C:\files")); * * config.AddAclRule(new AclRule( * new StringMatcher("*"), * new StringMatcher("*"), * new StringMatcher("*"), * new Dictionary<Permission, PermissionType> { { Permission.All, PermissionType.Allow } })); * * If you installed CKSource.CKFinder.Connector.Config, you may load the static configuration * from XML: * config.LoadConfig(); * * If you installed CKSource.CKFinder.Connector.KeyValue.EntityFramework, you may enable caching: * config.SetKeyValueStoreProvider( * new EntityFrameworkKeyValueStoreProvider("CKFinderCacheConnection")); */ } ); /* * Build the connector middleware. */ var connector = connectorBuilder .Build(connectorFactory); /* * Add the CKFinder connector middleware to the web application pipeline. */ app.UseConnector(connector); }
private static void SetupConnector(IAppBuilder app) { /* * Create a connector instance using ConnectorBuilder. The call to the LoadConfig() method * will configure the connector using CKFinder configuration options defined in Web.config. */ var connectorFactory = new OwinConnectorFactory(); var connectorBuilder = new ConnectorBuilder(); /* * Create an instance of authenticator implemented in the previous step. */ var customAuthenticator = new CustomCKFinderAuthenticator(); connectorBuilder /* * Provide the global configuration. * * If you installed CKSource.CKFinder.Connector.Config you may load static configuration * from XML: * connectorBuilder.LoadConfig(); */ .LoadConfig() .SetAuthenticator(customAuthenticator) .SetRequestConfiguration( (request, config) => { /* Add a local backend. */ //config.AddProxyBackend("local", new LocalStorage(@"public/upload")); config.AddBackend("local", new LocalStorage(@"public/upload", "http://www.stampecreative.it/public/upload/")); /* Add a resource type that uses the local backend. */ config.AddResourceType("Files", resourceBuilder => resourceBuilder.SetBackend("local", "files")); config.AddResourceType("Images", resourceBuilder => resourceBuilder.SetBackend("local", "images")); /* Give full access to all resource types at any path for all users. */ config.AddAclRule(new AclRule( new StringMatcher("*"), new StringMatcher("/"), new StringMatcher("*"), new Dictionary <Permission, PermissionType> { { Permission.FolderView, PermissionType.Allow }, { Permission.FolderCreate, PermissionType.Allow }, { Permission.FolderRename, PermissionType.Allow }, { Permission.FolderDelete, PermissionType.Allow }, { Permission.FileView, PermissionType.Allow }, { Permission.FileCreate, PermissionType.Allow }, { Permission.FileRename, PermissionType.Allow }, { Permission.FileDelete, PermissionType.Allow }, { Permission.ImageResize, PermissionType.Allow }, { Permission.ImageResizeCustom, PermissionType.Allow } })); }); /* * Configure settings per request. * * The minimal configuration has to include at least one backend, one resource type * and one ACL rule. * * For example: * config.AddBackend("default", new LocalStorage(@"C:\files")); * config.AddResourceType("images", builder => builder.SetBackend("default", "images")); * config.AddAclRule(new AclRule( * new StringMatcher("*"), * new StringMatcher("*"), * new StringMatcher("*"), * new Dictionary<Permission, PermissionType> { { Permission.All, PermissionType.Allow } })); * * If you installed CKSource.CKFinder.Connector.Config, you may load the static configuration * from XML: * config.LoadConfig(); * * If you installed CKSource.CKFinder.Connector.KeyValue.EntityFramework, you may enable caching: * config.SetKeyValueStoreProvider( * new EntityFrameworkKeyValueStoreProvider("CKFinderCacheConnection")); */ /* * Build the connector middleware. */ var connector = connectorBuilder .Build(connectorFactory); /* * Add the CKFinder connector middleware to the web application pipeline. */ app.UseConnector(connector); }