Client Configuration

To communicate with Core 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 constructor 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\ 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="http://imagevault.local/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="//myivcdn.azureedge.net/iv/"/>
    </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 enabled 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.

TypeDescriptionDefault durationDefault expiration
MediaCache for client Client.Load/ Client.Query operations on Media types.60Sliding
MediaItemCache for client Client.Load/ Client.Query operations on MediaItem types.1Sliding

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.

comments powered by Disqus