CKFinder 3 – ASP.NET Connector Documentation
ConnectorConfiguration Class Reference

Defines connector's configuration. More...

Public Member Functions

 ConnectorConfiguration ()
 Constructs a new instance of ConnectorConfiguration. More...
 
ConnectorConfiguration AddBackend (string name, IFileSystem fileSystem, string baseUrl=null, bool isProxy=false)
 Adds a backend to the connector. More...
 
ConnectorConfiguration AddProxyBackend (string name, IFileSystem fileSystem)
 Adds a backend to the connector. More...
 
ConnectorConfiguration RemoveBackend (string backendName)
 Removes a backend from the connector. More...
 
IBackend GetBackend (string backendName)
 Gets a backend with given name. More...
 
ConnectorConfiguration AddResourceType (string resourceTypeName, Action< ResourceTypeBuilder > resourceBuilderAction)
 Adds ResourceType to the connector. More...
 
ConnectorConfiguration RemoveResourceType (string resourceTypeName)
 Removes ResourceType from the connector. More...
 
ConnectorConfiguration AddAclRule (AclRule aclRule)
 Adds AclRule to the connector. More...
 
ConnectorConfiguration RemoveAclRule (AclRule aclRule)
 Removes AclRule from the connector. More...
 
ConnectorConfiguration SetThumbnailSizes (params SizeAndQuality[] allowedSizes)
 Sets allowed thumbnail sizes for the connector. More...
 
ConnectorConfiguration SetThumbnailBackend (string backendName, string thumbnailsPath)
 Defines which backend should be used for storing thumbnails. More...
 
ConnectorConfiguration SetImageResizeThreshold (int pixels, int percent)
 Defines the maximum difference in width and height between cached and requested resized image. More...
 
ConnectorConfiguration SetMaxImageSize (Size maxSize)
 Defines maximum image size for the connector. More...
 
ConnectorConfiguration SetDefaultImageQuality (ImageQuality quality)
 Defines default image quality of JPEG images for the connector. The default quality has value of 80. More...
 
ConnectorConfiguration SetSizeDefinitions (params SizeDefinition[] sizeDefinitions)
 Sets size definitions to the connector. More...
 
ConnectorConfiguration SetCheckSizeAfterScaling (bool enable)
 Defines whether a file size will be checked after image resize during Upload command execution. More...
 
ConnectorConfiguration SetMaxFileSize (long maxFileSize)
 Defines the maximum file size that may be uploaded to the connector. More...
 
ConnectorConfiguration SetOverwriteOnUpload (bool enable)
 Defines whether Upload command will overwrite files. More...
 
ConnectorConfiguration SetDisallowUnsafeCharacters (bool enable)
 Defines whether to disallow creating folders and uploading files whose names contain characters that are not safe on an IIS web server. More...
 
ConnectorConfiguration SetCheckDoubleExtension (bool enable)
 Whether to allow for files with double file extension. More...
 
ConnectorConfiguration SetSecureImageUploads (bool enable)
 Defines whether to perform additional checks when uploading image files. More...
 
ConnectorConfiguration SetKeyValueStoreProvider (IKeyValueStoreProvider keyValueStoreProvider)
 Sets a IKeyValueStoreProvider for the connector. More...
 
ConnectorConfiguration SetProxyCacheSeconds (int seconds)
 Configures cache lifetime for Proxy command. More...
 

Detailed Description

Defines connector's configuration.

Constructor & Destructor Documentation

◆ ConnectorConfiguration()

Constructs a new instance of ConnectorConfiguration.

Member Function Documentation

◆ AddAclRule()

ConnectorConfiguration AddAclRule ( AclRule  aclRule)
inline

Adds AclRule to the connector.

Parameters
aclRuleAn instance of AclRule to add.
Returns
Current instance of ConnectorConfiguration.

◆ AddBackend()

ConnectorConfiguration AddBackend ( string  name,
IFileSystem  fileSystem,
string  baseUrl = null,
bool  isProxy = false 
)
inline

Adds a backend to the connector.

See also
AddProxyBackend, RemoveBackend
Parameters
nameA name of the backend. Must be non-empty and unique.
fileSystemAn instance of the file system used by this backend.
baseUrlBase URL for backend.
isProxyA boolean telling if backend should generate URLs that point to Proxy command.
Returns
Current instance of ConnectorConfiguration.

◆ AddProxyBackend()

ConnectorConfiguration AddProxyBackend ( string  name,
IFileSystem  fileSystem 
)
inline

Adds a backend to the connector.

See also
AddBackend, RemoveBackend

Proxy backends use connector's Proxy command to access it's resources.

This is a powerful option that allows to serve any files stored in CKFinder. Creating links to files for your web page may be difficult, or even impossible in some cases (for example when files are stored on a private FTP server, or files are not in the web server root folder). This method tells CKFinder to create links to files using the Proxy command.

Serving files this way has the following advantages:

  • The files do not need to be publicly accessible with direct links. You do not have to change your storage configuration to make files accessible for anonymous users.
  • Better control over access to files. You can use CKFinder ACL options to define more strict access rights to files (see the accessControl configuration option).
  • Easier control over client-side caching rules. Using the cache configuration option you can define for how long the file served by the Proxy command should be cached in the browser.

The disadvantage of this approach is that all links to files will be dependent on the CKFinder connector, so if you decide to remove CKFinder one day, the links will simply stop working.

Parameters
nameA name of the backend. Must be non-empty and unique.
fileSystemAn instance of the file system used by this backend.
Returns
Current instance of ConnectorConfiguration.

◆ AddResourceType()

ConnectorConfiguration AddResourceType ( string  resourceTypeName,
Action< ResourceTypeBuilder resourceBuilderAction 
)
inline

Adds ResourceType to the connector.

Parameters
resourceTypeNameA name of the ResourceType. Must be non-empty and unique.
resourceBuilderActionAn action to build the ResourceType. See ResourceTypeBuilder.
Returns
Current instance of ConnectorConfiguration.

◆ GetBackend()

IBackend GetBackend ( string  backendName)
inline

Gets a backend with given name.

Parameters
backendNameA name of the backend.
Returns
An instance of the backend or null if no backend with given name was found.

◆ RemoveAclRule()

ConnectorConfiguration RemoveAclRule ( AclRule  aclRule)
inline

Removes AclRule from the connector.

Parameters
aclRuleAn instance of AclRule to remove.
Returns
Current instance of ConnectorConfiguration.

◆ RemoveBackend()

ConnectorConfiguration RemoveBackend ( string  backendName)
inline

Removes a backend from the connector.

Parameters
backendNameA name of the backend.
Returns
Current instance of ConnectorConfiguration.

◆ RemoveResourceType()

ConnectorConfiguration RemoveResourceType ( string  resourceTypeName)
inline

Removes ResourceType from the connector.

Parameters
resourceTypeNameA name of the ResourceType.
Returns
Current instance of ConnectorConfiguration.

◆ SetCheckDoubleExtension()

ConnectorConfiguration SetCheckDoubleExtension ( bool  enable)
inline

Whether to allow for files with double file extension.

Due to security issues with Apache modules it is recommended to leave checkDoubleExtension enabled.

Parameters
enableWhether to allow for files with double file extension.
Returns
Current instance of ConnectorConfiguration.

◆ SetCheckSizeAfterScaling()

ConnectorConfiguration SetCheckSizeAfterScaling ( bool  enable)
inline

Defines whether a file size will be checked after image resize during Upload command execution.

Parameters
enableWhether a file size should be checked after image resize.
Returns
Current instance of ConnectorConfiguration.

◆ SetDefaultImageQuality()

ConnectorConfiguration SetDefaultImageQuality ( ImageQuality  quality)
inline

Defines default image quality of JPEG images for the connector. The default quality has value of 80.

This is used for resized images that don't define their own quality.

Parameters
qualityA default quality.
Returns
Current instance of ConnectorConfiguration.

◆ SetDisallowUnsafeCharacters()

ConnectorConfiguration SetDisallowUnsafeCharacters ( bool  enable)
inline

Defines whether to disallow creating folders and uploading files whose names contain characters that are not safe on an IIS web server.

Increases the security on an IIS web server.

Parameters
enableWhether to disallow creating folders and uploading files with unsafe names.
Returns
Current instance of ConnectorConfiguration.

◆ SetImageResizeThreshold()

ConnectorConfiguration SetImageResizeThreshold ( int  pixels,
int  percent 
)
inline

Defines the maximum difference in width and height between cached and requested resized image.

Parameters
pixelsThe maximum difference in width and height in pixels between cached and requested image.
percentThe maximum difference in width and height in percent between cached and requested image.
Returns
Current instance of ConnectorConfiguration.

◆ SetKeyValueStoreProvider()

ConnectorConfiguration SetKeyValueStoreProvider ( IKeyValueStoreProvider  keyValueStoreProvider)
inline

Sets a IKeyValueStoreProvider for the connector.

Parameters
keyValueStoreProviderAn instance of IKeyValueStoreProvider.
Returns
Current instance of ConnectorConfiguration.

◆ SetMaxFileSize()

ConnectorConfiguration SetMaxFileSize ( long  maxFileSize)
inline

Defines the maximum file size that may be uploaded to the connector.

Parameters
maxFileSizeA maximum file size in bytes.
Returns
Current instance of ConnectorConfiguration.

◆ SetMaxImageSize()

ConnectorConfiguration SetMaxImageSize ( Size  maxSize)
inline

Defines maximum image size for the connector.

Parameters
maxSizeA maximum allowed size.
Returns
Current instance of ConnectorConfiguration.

◆ SetOverwriteOnUpload()

ConnectorConfiguration SetOverwriteOnUpload ( bool  enable)
inline

Defines whether Upload command will overwrite files.

Parameters
enableWhether Upload command should overwrite files.
Returns
Current instance of ConnectorConfiguration.

◆ SetProxyCacheSeconds()

ConnectorConfiguration SetProxyCacheSeconds ( int  seconds)
inline

Configures cache lifetime for Proxy command.

Parameters
secondsAn amount of seconds for cache header.
Returns
Current instance of ConnectorConfiguration.

◆ SetSecureImageUploads()

ConnectorConfiguration SetSecureImageUploads ( bool  enable)
inline

Defines whether to perform additional checks when uploading image files.

The check is performed against files with image file's extensions and will return error when given file is not a valid image.

Parameters
enableWhether to perform additional checks when uploading image files.
Returns
Current instance of ConnectorConfiguration.

◆ SetSizeDefinitions()

ConnectorConfiguration SetSizeDefinitions ( params SizeDefinition[]  sizeDefinitions)
inline

Sets size definitions to the connector.

Parameters
sizeDefinitionsAn array or list of size definitions.
Returns
Current instance of ConnectorConfiguration.

◆ SetThumbnailBackend()

ConnectorConfiguration SetThumbnailBackend ( string  backendName,
string  thumbnailsPath 
)
inline

Defines which backend should be used for storing thumbnails.

Provided backend must be registered using AddBackend or AddProxyBackend method.

Parameters
backendNameA name of the backend used for thumbnails.
thumbnailsPathA path to thumbnails in the backend.
Returns
Current instance of ConnectorConfiguration.

◆ SetThumbnailSizes()

ConnectorConfiguration SetThumbnailSizes ( params SizeAndQuality[]  allowedSizes)
inline

Sets allowed thumbnail sizes for the connector.

Parameters
allowedSizesAn array or list of allowed sizes.
Returns
Current instance of ConnectorConfiguration.

The documentation for this class was generated from the following file: