Configuration (v5)
To communicate with the ImageVault service we need to configure the client that we should use. This is done by configuring the ClientConfigurationSection of the application configuration.
Authentication
Authentication uses Oauth2, client credentials grant. To retrieve a oauth access token we configure the client to use a user name/password request. This access token request passes it's information in clear text so transport layer encryption (SSL) is strongly encouraged. By default the ImageVault core is installed to be run on https so this should not be a problem.
Identities
When requesting a client a set of credentials are used.
SDK identity
The SDK identity is the user name/password that the client will authenticate as when either the client is created using the Client(ClientConfigurationSection) or if the SdkClient is requested.
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="imagevault.client" type="ImageVault.Client.Configuration.ClientConfigurationSection, ImageVault.Client"/>
</configSections>
<imagevault.client>
<authentication>
<sdkIdentity key="demouser" secret="P@55w0rd!" publishingIdentifier=""/>
</authentication>
</imagevault.client>
</configuration>
The publishingIdentifier key is optional and if used, will set the PublishIdentifier of the SdkClient.
Current user identity
If the ClientFactory.GetCurrentUserClient() method is used then we get a client that is using the current logged in user credentials.
Access token renewal
The access token retrieved from the service is normally valid for an hour. When the token has expired the client will request a new one based on the configuration. New tokens are only used in request to the Client methods so any cached instances retrieved using the Client.CreateChannel<T> method will not utilize the renewed token. Client will cache the channels as needed so there is no need to do this on your own.
Core
The connection to core only defines the endpoint where the ImageVault.Core service is hosted. The configuration is an EndpointConfigurationElement.
Just enter the url (including scheme and port) to the core service in the address attribute.
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="imagevault.client" type="ImageVault.Client.Configuration.ClientConfigurationSection, ImageVault.Client"/>
</configSections>
<imagevault.client>
<imageVaultCore address="https://imagevault.se:1234" />
</imagevault.client>
</configuration>
AppSettings
The client configuration also contains a set of appSettings that can be used to configure the client.
defaultMediaUrlBase
The url to use as prefix for all requested media. If left blank all media will use the ImageVault ui url. If you configure the media proxy handlers, you can enter the url to those handlers (often "imagevault").
defaultPublishedMediaUrlBase
If we uses an external media CDN/proxy then we enter the base address here to generate URL:s to that server. Will only affect published media urls. Internal media will still use the defaultMediaUrlBase configuration.
<?xml version="1.0"?>
<imagevault.client>
<appSettings>
<!--Points to the transparent media proxy-->
<add key="defaultMediaUrlBase" value="/imagevault/"/>
<!--Points to an external cdn that is connected to the imagevault ui (or the imagevault transparent media proxy)-->
<!--Will only be used for published media urls-->
<add key="defaultPublishedMediaUrlBase" value="//my.imagevault.media"/>
</appSettings>
</imagevault.client>
enableClientCache
A brute force client cache is included and is not aware of changes. To enable this, set to true. Default is false. We recommend using this cache on web front ends that mostly work with static data. If the client updates data, then this should be set to false. The default cache times are 1 minute for MediaItems and 1 hour for Media queries (using sliding cache). It will only affect data populated by the Client.Load or Client.Query methods. To configure the cache in more detail, please see the Client cache documentation.
imageVaultUiUrl
If the ui of the client is on an external site (not located at ~/imagevault) then specify the url to the ui site here.
disableMediaProxyHandler
If true, the address to all media will be redirected to the core service. Default is false.
ignoreMissingImageVaultDefaultRootCertificate
If set to true, the client will not complain if the Core SSL certificate is a standard ImageVault SSL certificate (even if the ImageVault root authority certificate isn't installed on the client machine).
ClientCache
To be able to control the client cache configured by the enableClientCache, the following section can be added inside the imagevault.client
section for more granular control.
Example:
<?xml version="1.0"?>
<configuration>
<imagevault.client>
<clientCache enabled="true">
<add type="Media" duration="120" expiration="Absolute"/>
<add type="MediaItem" duration="123" expiration="Sliding"/>
</clientCache>
</imagevault.client>
</configuration>
enabled
The enabled attribute overrides the enableClientCache. It controls if the client cache should be enabled or not. It is default set to true if the clientCache is defined. This value overrides the value defined by enableClientCache.
Cache types (add)
The client cache contains multiple types that it can cache. Each type can be configured individually. If not configured, the default setting for each cache will be used. The following cache types are available.
Type | Description | Default duration | Default expiration |
---|---|---|---|
Media | Cache for client Client.Load/Client.Query operations on Media types. | 1440 1 | Absolute 1 |
MediaItem | Cache for client Client.Load/Client.Query operations on MediaItem types. | 60 1 | Absolute 1 |
[1] Note: Prior version 5.14, default duration was 60 min sliding cache for Media and 1 min sliding for MediaItem.
type (required)
The type attribute defines what type of objects this configuration should effect. Can be any of the items in the table above.
duration (required)
The number of minutes the cache should be kept.
expiration (optional)
Can be either Absolute or Sliding. Absolute will expire the cached item when the duration time is up. Sliding will expire the item if it hasn't been accessed before the duration time is up. Default value is Sliding.
AppSettings (global)
Some settings can be set using the web/app.config file for the client application
iv:authSameSiteCookieMode
Override default value for same site configuration. Can be blank, "lax", "strict" or "none". Default is blank.
<add key="iv:authSameSiteCookieMode" value="none"/>
iv:identityPrefix
If you have multiple ImageVaults that uses different user catalogs you can set the identity prefix to a value that will be prefixed all user and group identities to guarantee uniqueness between users and groups. You configure the identity prefix in the ImageVault UI application and NOT on the client.
iv:applicationInsightsDeveloperMode
When using AI, entries are buffered and not sent immediately to the AI instance (once per minute). If developer mode is activated, entries are sent immediately. This can reduce performance in production.
iv:applicationInsightsDisabled
Application insights is enabled if you enter an Application Insights connection string. If you would like to disable it without clearing the Application Insights connection string, set the disabled value to true.
iv:applicationInsightsEnableProfiling
Enables profiling for ImageVault and sends detailed profiling data to AI.
iv:mediaRendererResourceServiceUrl
The media renderer relies on resource files, like scripts and stylesheets. These are normally bundled with the ImageVault service and the default value of this property is "/". If you would like the resources to be loaded from another source, you can specify this source here.
iv:defaultMediaFormatOutputType
Note
Added in ImageVault.Common v5.22)
As default, reqeusted assets are retrieved using the MediaOutputFormatType.WebSafe output type unless specified on the requested format. This option is used to configure the default output type without having to change any code when retrieving assets. For instance, if you would like to utilize the webp format, set this to use the MediaOutputFormatType.WebSafeWebP format as default.
<add key="iv:defaultMediaFormatOutputType" value="WebSafeWebP"/>