The following example is an implementation of the Caplin.StreamLink.ICredentialsProvider interface, that supplies a non-changeable username and password to the StreamLink API when it needs to login to the Liberator.
The call to the Caplin.StreamLink.ICredentialsProvider.Credentials property should block, so if a time-sensitive password is required, then it should be retrieved during this call.
CopyC#
using System; using System.Collections.Generic; using System.Text; namespace Caplin.StreamLink.Authentication { /// <summary> /// Implements a credentials provider with a non-changing username and password /// </summary> public class CredentialsProvider : ICredentialsProvider { private string _password; private string _username; /// <summary> /// Initializes a new instance of the PasswordCredentials class. /// </summary> /// <param name="username">The username.</param> /// <param name="password">The password.</param> public CredentialsProvider(string username, string password) { _username = username; _password = password; } #region ICredentialsProvider Members /// <summary> /// Gets the credentials used to login to the Liberator. /// </summary> /// <value>The credentials.</value> public ICredentials Credentials { get { return new Credentials(_username, _password); } } #endregion } }