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 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); }