private static void SetupConnector(IAppBuilder app) { /* * Create connector instance using ConnectorBuilder. The call to LoadConfig() method * will configure the connector using CKFinder configuration options defined in Web.config. */ var connectorFactory = new OwinConnectorFactory(); var connectorBuilder = new ConnectorBuilder(); var customAuthenticator = new CustomCKFinderAuthenticator(); var connector = connectorBuilder .LoadConfig() .SetRequestConfiguration( (request, config) => { config.LoadConfig(); var privateBackend = config.GetBackend("CKFinderPrivate"); /* * Create a key-value store provider to be used for saving CKFinder cache data. */ var keyValueStoreProvider = new FileSystemKeyValueStoreProvider(privateBackend); config.SetKeyValueStoreProvider(keyValueStoreProvider); }) .SetAuthenticator(customAuthenticator) .Build(connectorFactory); /* * Add the CKFinder connector middleware to 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 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 builder) { var keyValueStoreProvider = new EntityFrameworkKeyValueStoreProvider("CacheConnectionString"); var authenticator = new ShaggysAuthenticator(); var connectorFactory = new OwinConnectorFactory(); var connectorBuilder = new ConnectorBuilder(); var connector = connectorBuilder .LoadConfig() .SetAuthenticator(authenticator) .SetRequestConfiguration( (request, config) => { config.LoadConfig(); config.SetKeyValueStoreProvider(keyValueStoreProvider); }) .Build(connectorFactory); builder.UseConnector(connector); }
private static void SetupConnector(IAppBuilder builder) { var keyValueStoreProvider = new EntityFrameworkKeyValueStoreProvider("CacheConnectionString"); var allowedRoleMatcherTemplate = ConfigurationManager.AppSettings["ckfinderAllowedRole"]; var authenticator = new RoleBasedAuthenticator(allowedRoleMatcherTemplate); var connectorFactory = new OwinConnectorFactory(); var connectorBuilder = new ConnectorBuilder(); var connector = connectorBuilder .LoadConfig() .SetAuthenticator(authenticator) .SetRequestConfiguration( (request, config) => { config.LoadConfig(); config.SetKeyValueStoreProvider(keyValueStoreProvider); }) .Build(connectorFactory); builder.UseConnector(connector); }
private static void SetupConnector(IAppBuilder builder) { var allowedRoleMatcherTemplate = ConfigurationManager.AppSettings["ckfinderAllowedRole"]; var authenticator = new RoleBasedAuthenticator(allowedRoleMatcherTemplate); var connectorFactory = new OwinConnectorFactory(); var connectorBuilder = new ConnectorBuilder(); var connector = connectorBuilder .LoadConfig() .SetAuthenticator(authenticator) .SetRequestConfiguration( (request, config) => { config.LoadConfig(); var defaultBackend = config.GetBackend("default"); var keyValueStoreProvider = new FileSystemKeyValueStoreProvider(defaultBackend); config.SetKeyValueStoreProvider(keyValueStoreProvider); }) .Build(connectorFactory); builder.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 CkIdentityModels(); 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) => { /* * 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: */ //System.Web.Hosting.HostingEnvironment.MapPath(@"~/EmailTemplates/ContactEmail.html") //config.AddBackend("default", new LocalStorage(System.Web.Hosting.HostingEnvironment.MapPath(@"~/Upload/Ckfinder/files"))); //config.AddBackend("default", new LocalStorage(System.Web.Hosting.HostingEnvironment.MapPath(@"~/Upload/Ckfinder/files"))); var xx = System.Web.Hosting.HostingEnvironment.MapPath(@"~/Upload"); config.AddBackend("local", new LocalStorage(xx)); config.AddResourceType("images", builder => builder.SetBackend("local", "Ckfinder")); 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("local"); var keyValueStoreProvider = new FileSystemKeyValueStoreProvider(defaultBackend); config.SetKeyValueStoreProvider(keyValueStoreProvider); } ); /* * 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 .LoadConfig() .SetAuthenticator(customAuthenticator) .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.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("default"); var keyValueStoreProvider = new FileSystemKeyValueStoreProvider(defaultBackend); config.SetKeyValueStoreProvider(keyValueStoreProvider); } ); /* * 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) => { /* * 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); }
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); }