/// <summary> /// Constructor /// </summary> /// <param name="isUiSupported">Does this authentication manager support a UI?</param> /// <param name="applicationToken">An application token to be used as the file name to store data as (no extension needed). Each /// consuming application should use a unique name in order to ensure that the user credentials are not /// overwritten by other applications. An exception will be thrown elsewhere if this is not a valid file name.</param> /// <param name="encryptionKey">The encryption key, or salt, to be used for any encryption routines. This salt /// should be different for each user, and not the same for everyone consuming the same application. Only used /// for UI support.</param> /// <param name="encryptionRoutines">The encryption routines to use for encryption/decryption of data. Only used for UI support.</param> /// <param name="webServiceVersion">The version of the WSAPI API to use.</param> protected ApiAuthManager(bool isUiSupported, string applicationToken, string encryptionKey, IEncryptionRoutines encryptionRoutines, string webServiceVersion = RallyRestApi.DEFAULT_WSAPI_VERSION) { if (isUiSupported) { if (String.IsNullOrWhiteSpace(applicationToken)) { throw new ArgumentNullException("applicationToken", "You must provide an application token."); } if (encryptionKey == null) { throw new ArgumentNullException("encryptionKey", "You must provide an encryption key that will be used to keep user data safe."); } if (encryptionRoutines == null) { throw new ArgumentNullException("encryptionRoutines", "You must provide encryption routines that will be used to keep user data safe."); } ApplicationToken = applicationToken; EncryptionKey = encryptionKey; EncryptionRoutines = encryptionRoutines; LoginDetails = new LoginDetails(this); LoginDetails.LoadFromDisk(); } IsUiSupported = isUiSupported; Api = new RallyRestApi(this, webServiceVersion: webServiceVersion); }
/// <summary> /// Constructor /// </summary> /// <param name="applicationToken">An application token to be used as the file name to store data as. Each /// consuming application should use a unique name in order to ensure that the user credentials are not /// overwritten by other applications.</param> /// <param name="encryptionKey">The encryption key, or salt, to be used for any encryption routines. This salt /// should be different for each user, and not the same for everyone consuming the same application. Only used /// for UI support.</param> /// <param name="encryptionRoutines">The encryption routines to use for encryption/decryption of data. Only used for UI support.</param> /// <param name="webServiceVersion">The version of the WSAPI API to use.</param> /// <example> /// <code language="C#"> /// // You must define your own private application token. This ensures that your login details are not overwritten by someone else. /// string applicationToken = "RallyRestAPISample"; /// // You must set a user specific salt for encryption. /// string encryptionKey = "UserSpecificSaltForEncryption"; /// // You must define your own encryption routines. /// IEncryptionRoutines encryptionUtilities = new EncryptionUtilities(); /// /// // Instantiate authorization manager /// wpfAuthMgr = new RestApiAuthMgrWpf(applicationToken, encryptionKey, encryptionUtilities); /// </code> /// </example> public RestApiAuthMgrWpf(string applicationToken, string encryptionKey, IEncryptionRoutines encryptionRoutines, string webServiceVersion = RallyRestApi.DEFAULT_WSAPI_VERSION) : base(true, applicationToken, encryptionKey, encryptionRoutines, webServiceVersion) { // NOTE: The example for this constructor is also used for the RallyRestApi // constructor. Make sure you update both if you change it. }
/// <summary> /// Constructor /// </summary> /// <param name="applicationToken">An application token to be used as the file name to store data as. Each /// consuming application should use a unique name in order to ensure that the user credentials are not /// overwritten by other applications.</param> /// <param name="encryptionKey">The encryption key, or salt, to be used for any encryption routines. This salt /// should be different for each user, and not the same for everyone consuming the same application. Only used /// for UI support.</param> /// <param name="encryptionRoutines">The encryption routines to use for encryption/decryption of data. Only used for UI support.</param> /// <param name="webServiceVersion">The version of the WSAPI API to use.</param> /// <param name="traceInfo">Controls diagnostic trace information being logged</param> public RestApiAuthMgrWinforms(string applicationToken, string encryptionKey, IEncryptionRoutines encryptionRoutines, string webServiceVersion = RallyRestApi.DEFAULT_WSAPI_VERSION, TraceFieldEnum traceInfo = RallyRestApi.DEFAULT_TRACE_FIELDS) : base(true, applicationToken, encryptionKey, encryptionRoutines, webServiceVersion, traceInfo) { }
/// <summary> /// Constructor /// </summary> /// <param name="applicationToken">An application token to be used as the file name to store data as. Each /// consuming application should use a unique name in order to ensure that the user credentials are not /// overwritten by other applications.</param> /// <param name="encryptionKey">The encryption key, or salt, to be used for any encryption routines. This salt /// should be different for each user, and not the same for everyone consuming the same application. Only used /// for UI support.</param> /// <param name="encryptionRoutines">The encryption routines to use for encryption/decryption of data. Only used for UI support.</param> /// <param name="webServiceVersion">The version of the WSAPI API to use.</param> public RestApiAuthMgrWinforms(string applicationToken, string encryptionKey, IEncryptionRoutines encryptionRoutines, string webServiceVersion = RallyRestApi.DEFAULT_WSAPI_VERSION) : base(true, applicationToken, encryptionKey, encryptionRoutines, webServiceVersion) { }