本文整理汇总了C#中QueryParameters.ToEncodedString方法的典型用法代码示例。如果您正苦于以下问题:C# QueryParameters.ToEncodedString方法的具体用法?C# QueryParameters.ToEncodedString怎么用?C# QueryParameters.ToEncodedString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryParameters
的用法示例。
在下文中一共展示了QueryParameters.ToEncodedString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DirectUserToServiceProvider
public void DirectUserToServiceProvider()
{
UriBuilder ub = new UriBuilder(provider.UserLoginEndpoint);
try
{
QueryParameters oauthParams = new QueryParameters();
oauthParams.Add("client_id", provider.Consumerkey);
oauthParams.Add("redirect_uri", connectionToken.ProviderCallbackUrl);
oauthParams.Add("response_type", "code");
oauthParams.Add("scope", provider.GetScope());
//ub.SetQueryparameter("client_id", provider.Consumerkey);
//ub.SetQueryparameter("redirect_uri", connectionToken.ProviderCallbackUrl);
//ub.SetQueryparameter("response_type", "code");
//ub.SetQueryparameter("scope", provider.GetScope());
BeforeDirectingUserToServiceProvider(oauthParams);
logger.Debug("Redirecting user for login to " + ub.ToString() + "?" + oauthParams.ToEncodedString());
SocialAuthUser.Redirect(ub.ToString() + "?" + oauthParams.ToEncodedString());
}
catch (Exception ex)
{
logger.Error(ErrorMessages.UserLoginRedirectionError(ub.ToString()), ex);
throw new OAuthException(ErrorMessages.UserLoginRedirectionError(ub.ToString()), ex);
}
}
示例2: GetLoginUrl
public override string GetLoginUrl(string returnUrl)
{
var oauthParameters = new QueryParameters();
string processedUrl = "";
if(string.IsNullOrEmpty(provider.UserLoginEndpoint))
PerformDiscovery();
oauthParameters.Add("openid.ns", "http://specs.openid.net/auth/2.0");
oauthParameters.Add("openid.claimed_id", "http://specs.openid.net/auth/2.0/identifier_select");
oauthParameters.Add("openid.identity", "http://specs.openid.net/auth/2.0/identifier_select");
oauthParameters.Add("openid.return_to", returnUrl);
oauthParameters.Add("openid.realm", ConnectionToken.Domain);
oauthParameters.Add("openid.mode", "checkid_setup");
oauthParameters.Add("openid.ns.pape", "http://specs.openid.net/extensions/pape/1.0");
oauthParameters.Add("openid.ns.max_auth_age", "0");
oauthParameters.Add("openid.ns.ax", "http://openid.net/srv/ax/1.0");
oauthParameters.Add("openid.ax.mode", "fetch_request");
oauthParameters.Add("openid.ax.type.country", "http://axschema.org/contact/country/home");
oauthParameters.Add("openid.ax.type.email", "http://axschema.org/contact/email");
oauthParameters.Add("openid.ax.type.firstname", "http://axschema.org/namePerson/first");
oauthParameters.Add("openid.ax.type.language", "http://axschema.org/pref/language");
oauthParameters.Add("openid.ax.type.lastname", "http://axschema.org/namePerson/last");
oauthParameters.Add("openid.ax.required", "country,email,firstname,language,lastname");
//ADDING OAUTH PROTOCOLS
oauthParameters.Add("openid.ns.oauth", "http://specs.openid.net/extensions/oauth/1.0");
oauthParameters.Add("openid.oauth.consumer", provider.Consumerkey);
BeforeDirectingUserToServiceProvider(oauthParameters);
processedUrl = oauthParameters.ToEncodedString();
return provider.UserLoginEndpoint + "?" + processedUrl;
}
示例3: GetLoginUrl
public override string GetLoginUrl(string returnUrl)
{
var ub = new UriBuilder(provider.UserLoginEndpoint);
var oauthParams = new QueryParameters();
oauthParams.Add("client_id", provider.Consumerkey);
oauthParams.Add("redirect_uri", returnUrl);
oauthParams.Add("response_type", "code");
oauthParams.Add("scope", provider.GetScope());
BeforeDirectingUserToServiceProvider(oauthParams);
return ub.ToString() + "?" + oauthParams.ToEncodedString();
}
示例4: DirectUserToServiceProvider
public void DirectUserToServiceProvider()
{
QueryParameters oauthParameters = new QueryParameters();
string processedUrl = "";
try
{
oauthParameters.Add("openid.ns", "http://specs.openid.net/auth/2.0");
oauthParameters.Add("openid.claimed_id", "http://specs.openid.net/auth/2.0/identifier_select");
oauthParameters.Add("openid.identity", "http://specs.openid.net/auth/2.0/identifier_select");
oauthParameters.Add("openid.return_to", connectionToken.ProviderCallbackUrl);
oauthParameters.Add("openid.realm", connectionToken.Domain);
oauthParameters.Add("openid.mode", "checkid_setup");
oauthParameters.Add("openid.ns.pape", "http://specs.openid.net/extensions/pape/1.0");
oauthParameters.Add("openid.ns.max_auth_age", "0");
oauthParameters.Add("openid.ns.ax", "http://openid.net/srv/ax/1.0");
oauthParameters.Add("openid.ax.mode", "fetch_request");
oauthParameters.Add("openid.ax.type.country", "http://axschema.org/contact/country/home");
oauthParameters.Add("openid.ax.type.email", "http://axschema.org/contact/email");
oauthParameters.Add("openid.ax.type.firstname", "http://axschema.org/namePerson/first");
oauthParameters.Add("openid.ax.type.language", "http://axschema.org/pref/language");
oauthParameters.Add("openid.ax.type.lastname", "http://axschema.org/namePerson/last");
oauthParameters.Add("openid.ax.required", "country,email,firstname,language,lastname");
//ADDING OAUTH PROTOCOLS
oauthParameters.Add("openid.ns.oauth", "http://specs.openid.net/extensions/oauth/1.0");
oauthParameters.Add("openid.oauth.consumer", provider.Consumerkey);
BeforeDirectingUserToServiceProvider(oauthParameters);
processedUrl = oauthParameters.ToEncodedString();
logger.Debug("Redirecting user for login to " + processedUrl);
SocialAuthUser.Redirect(provider.UserLoginEndpoint + "?" + processedUrl);
}
catch (Exception ex)
{
logger.Error(ErrorMessages.UserLoginRedirectionError(provider.UserLoginEndpoint + "?" + processedUrl), ex);
}
}