示例#1
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary>
        ///     Gets authentication URL.
        /// </summary>
        /// <remarks>
        ///     Anwar Javed, 09/14/2013 5:31 PM.
        /// </remarks>
        /// <param name="successUrl">
        ///     URL of the success.
        /// </param>
        /// <param name="failureUrl">
        ///     URL of the failure.
        /// </param>
        /// <param name="state">
        ///     The state.
        /// </param>
        /// <returns>
        ///     The authentication URL.
        /// </returns>
        /// -------------------------------------------------------------------------------------------------
        public IHtmlString GetAuthenticationUrl(string successUrl, string failureUrl, string state)
        {
            var builder = new UrlBuilder(SocialApiSetting.BuildUrl(this.Domain, "social/yahoo/authenticate"));

            builder.QueryString.Add("success", successUrl);
            builder.QueryString.Add("failure", failureUrl);

            if (!string.IsNullOrWhiteSpace(state))
            {
                builder.QueryString.Add("state", state);
            }

            return(new HtmlString(builder.ToString(false)));
        }
示例#2
0
        public IHtmlString GetAuthenticationUrl(
            string successUrl,
            string failureUrl,
            string state = null,
            params string[] permissions)
        {
            var builder = new UrlBuilder(SocialApiSetting.BuildUrl(this.Domain, "social/facebook/authenticate"));

            builder.QueryString.Add("success", successUrl);
            builder.QueryString.Add("failure", failureUrl);
            builder.QueryString.Add("permissions", permissions.ToConcatenatedString(x => x, ","));

            if (!string.IsNullOrWhiteSpace(state))
            {
                builder.QueryString.Add("state", state);
            }

            return(new HtmlString(builder.ToString(false)));
        }