Ejemplo n.º 1
0
Archivo: Rtm.cs Proyecto: nolith/tasque
        /// <summary>
        /// Calculates the URL to redirect the user to Rtm web site for
        /// auehtntication. Used by Web applications.
        /// See <see cref="AuthGetFrob"/> for example code.
        /// </summary>
        /// <remarks>
        /// The Rtm web site provides 'tiny urls' that can be used in place
        /// of this URL when you specify your return url in the API key page.
        /// It is recommended that you use these instead as they do not include
        /// your API or shared secret.
        /// </remarks>
        /// <param name="authLevel">The <see cref="AuthLevel"/> stating the maximum authentication level your application requires.</param>
        /// <returns>The url to redirect the user to.</returns>
        public string AuthCalcWebUrl(AuthLevel authLevel)
        {
            if (sharedSecret == null)
            {
                throw new SignatureRequiredException();
            }

            string hash = sharedSecret + "api_key" + apiKey + "perms" + authLevel.ToString().ToLower();

            hash = Md5Hash(hash);
            string url = AuthUrl + "?api_key=" + apiKey + "&perms=" + authLevel.ToString().ToLower();

            url += "&api_sig=" + hash;

            return(url);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calculates the URL to redirect the user to Flickr web site for
        /// auehtntication. Used by Web applications. 
        /// See <see cref="AuthGetFrob"/> for example code.
        /// </summary>
        /// <remarks>
        /// The Flickr web site provides 'tiny urls' that can be used in place
        /// of this URL when you specify your return url in the API key page.
        /// It is recommended that you use these instead as they do not include
        /// your API or shared secret.
        /// </remarks>
        /// <param name="authLevel">The <see cref="AuthLevel"/> stating the maximum authentication level your application requires.</param>
        /// <returns>The url to redirect the user to.</returns>
        public string AuthCalcWebUrl(AuthLevel authLevel)
        {
            if( _sharedSecret == null ) throw new FlickrException(0, "AuthGetToken requires signing. Please supply api key and secret.");

            string hash = _sharedSecret + "api_key" + _apiKey + "perms" + authLevel.ToString().ToLower();
            hash = Md5Hash(hash);
            string url = AuthUrl + "?api_key=" + _apiKey + "&perms=" + authLevel.ToString().ToLower();
            url += "&api_sig=" + hash;

            return url;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Calculates the URL to redirect the user to Rtm web site for
        /// authentication. Used by desktop application. 
        /// See <see cref="AuthGetFrob"/> for example code.
        /// </summary>
        /// <param name="frob">The FROB to be used for authentication.</param>
        /// <param name="authLevel">The <see cref="AuthLevel"/> stating the maximum authentication level your application requires.</param>
        /// <returns>The url to redirect the user to.</returns>
        public string AuthCalcUrl(string frob, AuthLevel authLevel)
        {
            if( sharedSecret == null ) throw new SignatureRequiredException();

            string hash = sharedSecret + "api_key" + apiKey + "frob" + frob + "perms" + authLevel.ToString().ToLower();
            hash = Md5Hash(hash);
            string url = AuthUrl + "?api_key=" + apiKey + "&perms=" + authLevel.ToString().ToLower() + "&frob=" + frob;
            url += "&api_sig=" + hash;

            return url;
        }
Ejemplo n.º 4
0
		/// <summary>
		/// Calculates the URL to redirect the user to Flickr web site for
		/// auehtntication. Used by Web applications.
		/// See <see cref="AuthGetFrob"/> for example code.
		/// </summary>
		/// <remarks>
		/// The Flickr web site provides 'tiny urls' that can be used in place
		/// of this URL when you specify your return url in the API key page.
		/// It is recommended that you use these instead as they do not include
		/// your API or shared secret.
		/// </remarks>
		/// <param name="authLevel">The <see cref="AuthLevel"/> stating the maximum authentication level your application requires.</param>
		/// <returns>The url to redirect the user to.</returns>
		public string AuthCalcWebUrl(AuthLevel authLevel)
		{
			if( _sharedSecret == null ) throw new SignatureRequiredException();

			string hash = _sharedSecret + "api_key" + _apiKey + "perms" + authLevel.ToString().ToLower();
			hash = Md5Hash(hash);
			string url = AuthUrl + "?api_key=" + _apiKey + "&perms=" + authLevel.ToString().ToLower();
			url += "&api_sig=" + hash;

			return url;
		}
Ejemplo n.º 5
0
 public override string ToString()
 {
     return($"Auth({Name}, {AuthLevel.ToString()}, {Style.ToString()})[{TotalActionsPerformed}]");
 }