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 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.
When requesting a client a set of credentials are used.
<?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>
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\
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>
The client configuration also contains a set of appSettings that can be used to configure the client.
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").
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>
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.
If the ui of the client is on an external site (not located at ~/imagevault) then specify the url to the ui site here.
If true, the address to all media will be redirected to the core service. Default is false.
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).
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.
<?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>
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.||60||Sliding|
|MediaItem||Cache for client Client.Load/ Client.Query operations on MediaItem types.||1||Sliding|
The type attribute defines what type of objects this configuration should effect. Can be any of the items in the table above.
The number of minutes the cache should be kept.
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.