summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/DotNetOpenAuth.AspNet/AuthenticationResult.cs4
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs24
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs7
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth/InMemoryOAuthTokenManager.cs10
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs25
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs48
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs20
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs32
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/JsonHelper.cs6
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs10
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/WindowsLiveClient.cs37
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs5
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs5
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs5
-rw-r--r--src/DotNetOpenAuth.AspNet/DotNetOpenAuth.AspNet.csproj1
-rw-r--r--src/DotNetOpenAuth.AspNet/IOpenAuthDataProvider.cs11
-rw-r--r--src/DotNetOpenAuth.AspNet/OpenAuthAuthenticationTicketHelper.cs23
-rw-r--r--src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs53
-rw-r--r--src/DotNetOpenAuth.AspNet/Properties/AssemblyInfo.cs9
-rw-r--r--src/DotNetOpenAuth.AspNet/UriHelper.cs6
20 files changed, 151 insertions, 190 deletions
diff --git a/src/DotNetOpenAuth.AspNet/AuthenticationResult.cs b/src/DotNetOpenAuth.AspNet/AuthenticationResult.cs
index 84d9abe..d5ef109 100644
--- a/src/DotNetOpenAuth.AspNet/AuthenticationResult.cs
+++ b/src/DotNetOpenAuth.AspNet/AuthenticationResult.cs
@@ -19,7 +19,7 @@ namespace DotNetOpenAuth.AspNet {
/// <summary>
/// Returns an instance which indicates failed authentication.
/// </summary>
- [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes",
+ [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes",
Justification = "This type is immutable.")]
public static readonly AuthenticationResult Failed = new AuthenticationResult(isSuccessful: false);
@@ -34,7 +34,7 @@ namespace DotNetOpenAuth.AspNet {
/// if set to <c>true</c> [is successful].
/// </param>
public AuthenticationResult(bool isSuccessful)
- : this(isSuccessful, provider: null, providerUserId: null, userName: null, extraData: null) {}
+ : this(isSuccessful, provider: null, providerUserId: null, userName: null, extraData: null) { }
/// <summary>
/// Initializes a new instance of the <see cref="AuthenticationResult"/> class.
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs
index 9757f30..7eda8e4 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs
@@ -22,7 +22,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <summary>
/// The _web consumer.
/// </summary>
- private readonly WebConsumer _webConsumer;
+ private readonly WebConsumer webConsumer;
#endregion
@@ -37,15 +37,11 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="tokenManager">
/// The token manager.
/// </param>
- /// <exception cref="ArgumentNullException">
- /// </exception>
- /// <exception cref="ArgumentNullException">
- /// </exception>
public DotNetOpenAuthWebConsumer(ServiceProviderDescription serviceDescription, IConsumerTokenManager tokenManager) {
Requires.NotNull(serviceDescription, "serviceDescription");
Requires.NotNull(tokenManager, "tokenManager");
- this._webConsumer = new WebConsumer(serviceDescription, tokenManager);
+ this.webConsumer = new WebConsumer(serviceDescription, tokenManager);
}
#endregion
@@ -61,19 +57,17 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="accessToken">
/// The access token.
/// </param>
- /// <returns>
- /// </returns>
+ /// <returns>An HTTP request.</returns>
public HttpWebRequest PrepareAuthorizedRequest(MessageReceivingEndpoint profileEndpoint, string accessToken) {
- return this._webConsumer.PrepareAuthorizedRequest(profileEndpoint, accessToken);
+ return this.webConsumer.PrepareAuthorizedRequest(profileEndpoint, accessToken);
}
/// <summary>
/// The process user authorization.
/// </summary>
- /// <returns>
- /// </returns>
+ /// <returns>The response message.</returns>
public AuthorizedTokenResponse ProcessUserAuthorization() {
- return this._webConsumer.ProcessUserAuthorization();
+ return this.webConsumer.ProcessUserAuthorization();
}
/// <summary>
@@ -84,9 +78,9 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// </param>
public void RequestAuthentication(Uri callback) {
var redirectParameters = new Dictionary<string, string> { { "force_login", "false" } };
- UserAuthorizationRequest request = this._webConsumer.PrepareRequestUserAuthorization(
+ UserAuthorizationRequest request = this.webConsumer.PrepareRequestUserAuthorization(
callback, null, redirectParameters);
- this._webConsumer.Channel.PrepareResponse(request).Send();
+ this.webConsumer.Channel.PrepareResponse(request).Send();
}
#endregion
@@ -110,7 +104,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing) {
if (disposing) {
- this._webConsumer.Dispose();
+ this.webConsumer.Dispose();
}
}
}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs
index 413b624..a054a1c 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs
@@ -25,15 +25,13 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="accessToken">
/// The access token.
/// </param>
- /// <returns>
- /// </returns>
+ /// <returns>An HTTP request.</returns>
HttpWebRequest PrepareAuthorizedRequest(MessageReceivingEndpoint profileEndpoint, string accessToken);
/// <summary>
/// The process user authorization.
/// </summary>
- /// <returns>
- /// </returns>
+ /// <returns>The response message.</returns>
AuthorizedTokenResponse ProcessUserAuthorization();
/// <summary>
@@ -43,6 +41,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// The callback.
/// </param>
void RequestAuthentication(Uri callback);
+
#endregion
}
}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/InMemoryOAuthTokenManager.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/InMemoryOAuthTokenManager.cs
index b319d55..b45a65b 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/InMemoryOAuthTokenManager.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/InMemoryOAuthTokenManager.cs
@@ -20,7 +20,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <summary>
/// The _tokens and secrets.
/// </summary>
- private readonly Dictionary<string, string> _tokensAndSecrets = new Dictionary<string, string>();
+ private readonly Dictionary<string, string> tokensAndSecrets = new Dictionary<string, string>();
#endregion
@@ -100,8 +100,8 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// </remarks>
public void ExpireRequestTokenAndStoreNewAccessToken(
string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
- this._tokensAndSecrets.Remove(requestToken);
- this._tokensAndSecrets[accessToken] = accessTokenSecret;
+ this.tokensAndSecrets.Remove(requestToken);
+ this.tokensAndSecrets[accessToken] = accessTokenSecret;
}
/// <summary>
@@ -117,7 +117,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// Thrown if the secret cannot be found for the given token.
/// </exception>
public string GetTokenSecret(string token) {
- return this._tokensAndSecrets[token];
+ return this.tokensAndSecrets[token];
}
/// <summary>
@@ -149,7 +149,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// Request tokens stored by this method SHOULD NOT associate any user account with this token. It usually opens up security holes in your application to do so. Instead, you associate a user account with access tokens (not request tokens) in the <see cref="ExpireRequestTokenAndStoreNewAccessToken"/> method.
/// </remarks>
public void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response) {
- this._tokensAndSecrets[response.Token] = response.TokenSecret;
+ this.tokensAndSecrets[response.Token] = response.TokenSecret;
}
#endregion
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs
index 865a334..631636b 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs
@@ -28,17 +28,17 @@ namespace DotNetOpenAuth.AspNet.Clients {
public static readonly ServiceProviderDescription LinkedInServiceDescription = new ServiceProviderDescription {
RequestTokenEndpoint =
new MessageReceivingEndpoint(
- "https://api.linkedin.com/uas/oauth/requestToken",
- HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
+ "https://api.linkedin.com/uas/oauth/requestToken",
+ HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
UserAuthorizationEndpoint =
new MessageReceivingEndpoint(
- "https://www.linkedin.com/uas/oauth/authenticate",
- HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
+ "https://www.linkedin.com/uas/oauth/authenticate",
+ HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
AccessTokenEndpoint =
new MessageReceivingEndpoint(
- "https://api.linkedin.com/uas/oauth/accessToken",
- HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
- TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
+ "https://api.linkedin.com/uas/oauth/accessToken",
+ HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
+ TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
};
#endregion
@@ -54,10 +54,10 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="consumerSecret">
/// The LinkedIn app's consumer secret.
/// </param>
- [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope",
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope",
Justification = "We can't dispose the object because we still need it through the app lifetime.")]
public LinkedInClient(string consumerKey, string consumerSecret)
- : base("linkedIn", LinkedInServiceDescription, consumerKey, consumerSecret) {}
+ : base("linkedIn", LinkedInServiceDescription, consumerKey, consumerSecret) { }
#endregion
@@ -72,16 +72,15 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <returns>
/// Authentication result.
/// </returns>
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
+ [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
Justification = "We don't care if the request fails.")]
protected override AuthenticationResult VerifyAuthenticationCore(AuthorizedTokenResponse response) {
// See here for Field Selectors API http://developer.linkedin.com/docs/DOC-1014
- const string profileRequestUrl =
- "http://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,industry,summary)";
+ const string ProfileRequestUrl = "http://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,industry,summary)";
string accessToken = response.AccessToken;
- var profileEndpoint = new MessageReceivingEndpoint(profileRequestUrl, HttpDeliveryMethods.GetRequest);
+ var profileEndpoint = new MessageReceivingEndpoint(ProfileRequestUrl, HttpDeliveryMethods.GetRequest);
HttpWebRequest request = this.WebWorker.PrepareAuthorizedRequest(profileEndpoint, accessToken);
try {
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs
index 4152f0a..89cefad 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs
@@ -6,13 +6,13 @@
namespace DotNetOpenAuth.AspNet.Clients {
using System;
+ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Web;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth;
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.OAuth.Messages;
- using System.Collections.Generic;
/// <summary>
/// Represents base class for OAuth 1.0 clients
@@ -37,7 +37,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// </param>
protected OAuthClient(
string providerName, ServiceProviderDescription serviceDescription, string consumerKey, string consumerSecret)
- : this(providerName, serviceDescription, new InMemoryOAuthTokenManager(consumerKey, consumerSecret)) {}
+ : this(providerName, serviceDescription, new InMemoryOAuthTokenManager(consumerKey, consumerSecret)) { }
/// <summary>
/// Initializes a new instance of the <see cref="OAuthClient"/> class.
@@ -54,7 +54,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "I don't know how to ensure this rule is followed given this API")]
protected OAuthClient(
string providerName, ServiceProviderDescription serviceDescription, IConsumerTokenManager tokenManager)
- : this(providerName, new DotNetOpenAuthWebConsumer(serviceDescription, tokenManager)) {}
+ : this(providerName, new DotNetOpenAuthWebConsumer(serviceDescription, tokenManager)) { }
/// <summary>
/// Initializes a new instance of the <see cref="OAuthClient"/> class.
@@ -65,10 +65,6 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="webWorker">
/// The web worker.
/// </param>
- /// <exception cref="ArgumentNullException">
- /// </exception>
- /// <exception cref="ArgumentNullException">
- /// </exception>
protected OAuthClient(string providerName, IOAuthWebWorker webWorker) {
Requires.NotNull(providerName, "providerName");
Requires.NotNull(webWorker, "webWorker");
@@ -132,26 +128,24 @@ namespace DotNetOpenAuth.AspNet.Clients {
}
AuthenticationResult result = this.VerifyAuthenticationCore(response);
- if (result.IsSuccessful && result.ExtraData != null)
- {
- // add the access token to the user data dictionary just in case page developers want to use it
- var wrapExtraData = result.ExtraData.IsReadOnly
- ? new Dictionary<string, string>(result.ExtraData)
- : result.ExtraData;
- wrapExtraData["accesstoken"] = response.AccessToken;
-
- AuthenticationResult wrapResult = new AuthenticationResult(
- result.IsSuccessful,
- result.Provider,
- result.ProviderUserId,
- result.UserName,
- wrapExtraData
- );
-
- result = wrapResult;
- }
-
- return result;
+ if (result.IsSuccessful && result.ExtraData != null) {
+ // add the access token to the user data dictionary just in case page developers want to use it
+ var wrapExtraData = result.ExtraData.IsReadOnly
+ ? new Dictionary<string, string>(result.ExtraData)
+ : result.ExtraData;
+ wrapExtraData["accesstoken"] = response.AccessToken;
+
+ AuthenticationResult wrapResult = new AuthenticationResult(
+ result.IsSuccessful,
+ result.Provider,
+ result.ProviderUserId,
+ result.UserName,
+ wrapExtraData);
+
+ result = wrapResult;
+ }
+
+ return result;
}
#endregion
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs
index 01318b8..ceaffd4 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs
@@ -28,17 +28,17 @@ namespace DotNetOpenAuth.AspNet.Clients {
public static readonly ServiceProviderDescription TwitterServiceDescription = new ServiceProviderDescription {
RequestTokenEndpoint =
new MessageReceivingEndpoint(
- "http://twitter.com/oauth/request_token",
- HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
+ "http://twitter.com/oauth/request_token",
+ HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
UserAuthorizationEndpoint =
new MessageReceivingEndpoint(
- "http://twitter.com/oauth/authenticate",
- HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
+ "http://twitter.com/oauth/authenticate",
+ HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
AccessTokenEndpoint =
new MessageReceivingEndpoint(
- "http://twitter.com/oauth/access_token",
- HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
- TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
+ "http://twitter.com/oauth/access_token",
+ HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
+ TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
};
#endregion
@@ -54,10 +54,10 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="consumerSecret">
/// The consumer secret.
/// </param>
- [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope",
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope",
Justification = "We can't dispose the object because we still need it through the app lifetime.")]
public TwitterClient(string consumerKey, string consumerSecret)
- : base("twitter", TwitterServiceDescription, consumerKey, consumerSecret) {}
+ : base("twitter", TwitterServiceDescription, consumerKey, consumerSecret) { }
#endregion
@@ -72,7 +72,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <returns>
/// Authentication result
/// </returns>
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
+ [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
Justification = "We don't care if the request for additional data fails.")]
protected override AuthenticationResult VerifyAuthenticationCore(AuthorizedTokenResponse response) {
string accessToken = response.AccessToken;
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs
index 2d12202..f4ad20b 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs
@@ -32,12 +32,12 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <summary>
/// The _app id.
/// </summary>
- private readonly string _appId;
+ private readonly string appId;
/// <summary>
/// The _app secret.
/// </summary>
- private readonly string _appSecret;
+ private readonly string appSecret;
#endregion
@@ -52,17 +52,13 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="appSecret">
/// The app secret.
/// </param>
- /// <exception cref="ArgumentException">
- /// </exception>
- /// <exception cref="ArgumentException">
- /// </exception>
public FacebookClient(string appId, string appSecret)
: base("facebook") {
Requires.NotNullOrEmpty(appId, "appId");
Requires.NotNullOrEmpty(appSecret, "appSecret");
- this._appId = appId;
- this._appSecret = appSecret;
+ this.appId = appId;
+ this.appSecret = appSecret;
}
#endregion
@@ -75,13 +71,12 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="returnUrl">
/// The return url.
/// </param>
- /// <returns>
- /// </returns>
+ /// <returns>An absolute URI.</returns>
protected override Uri GetServiceLoginUrl(Uri returnUrl) {
// Note: Facebook doesn't like us to url-encode the redirect_uri value
var builder = new UriBuilder(AuthorizationEndpoint);
builder.AppendQueryArgs(
- new Dictionary<string, string> { { "client_id", this._appId }, { "redirect_uri", returnUrl.AbsoluteUri }, });
+ new Dictionary<string, string> { { "client_id", this.appId }, { "redirect_uri", returnUrl.AbsoluteUri }, });
return builder.Uri;
}
@@ -91,8 +86,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="accessToken">
/// The access token.
/// </param>
- /// <returns>
- /// </returns>
+ /// <returns>A dictionary of profile data.</returns>
protected override IDictionary<string, string> GetUserData(string accessToken) {
FacebookGraphData graphData;
var request =
@@ -116,7 +110,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
}
/// <summary>
- /// The query access token.
+ /// Obtains an access token given an authorization code and callback URL.
/// </summary>
/// <param name="returnUrl">
/// The return url.
@@ -125,17 +119,17 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// The authorization code.
/// </param>
/// <returns>
- /// The query access token.
+ /// The access token.
/// </returns>
protected override string QueryAccessToken(Uri returnUrl, string authorizationCode) {
// Note: Facebook doesn't like us to url-encode the redirect_uri value
var builder = new UriBuilder(TokenEndpoint);
builder.AppendQueryArgs(
new Dictionary<string, string> {
- { "client_id", this._appId },
- { "redirect_uri", returnUrl.AbsoluteUri },
- { "client_secret", this._appSecret },
- { "code", authorizationCode },
+ { "client_id", this.appId },
+ { "redirect_uri", returnUrl.AbsoluteUri },
+ { "client_secret", this.appSecret },
+ { "code", authorizationCode },
});
using (WebClient client = new WebClient()) {
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/JsonHelper.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/JsonHelper.cs
index 6343cb0..a7ff79e 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/JsonHelper.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/JsonHelper.cs
@@ -21,12 +21,10 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="stream">
/// The stream.
/// </param>
- /// <typeparam name="T">
- /// </typeparam>
+ /// <typeparam name="T">The type of the value to deserialize.</typeparam>
/// <returns>
+ /// The deserialized value.
/// </returns>
- /// <exception cref="ArgumentNullException">
- /// </exception>
public static T Deserialize<T>(Stream stream) where T : class {
Requires.NotNull(stream, "stream");
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs
index 0120615..016d92e 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs
@@ -17,14 +17,14 @@ namespace DotNetOpenAuth.AspNet.Clients {
#region Constants and Fields
/// <summary>
- /// The _provider name.
+ /// The provider name.
/// </summary>
private readonly string providerName;
/// <summary>
- /// The _return url.
+ /// The return url.
/// </summary>
- private Uri _returnUrl;
+ private Uri returnUrl;
#endregion
@@ -71,7 +71,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
Requires.NotNull(context, "context");
Requires.NotNull(returnUrl, "returnUrl");
- this._returnUrl = returnUrl;
+ this.returnUrl = returnUrl;
string redirectUrl = this.GetServiceLoginUrl(returnUrl).AbsoluteUri;
context.Response.Redirect(redirectUrl, endResponse: true);
@@ -94,7 +94,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
return AuthenticationResult.Failed;
}
- string accessToken = this.QueryAccessToken(this._returnUrl, code);
+ string accessToken = this.QueryAccessToken(this.returnUrl, code);
if (accessToken == null) {
return AuthenticationResult.Failed;
}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/WindowsLiveClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/WindowsLiveClient.cs
index c47559f..5e396a1 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/WindowsLiveClient.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/WindowsLiveClient.cs
@@ -30,12 +30,12 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <summary>
/// The _app id.
/// </summary>
- private readonly string _appId;
+ private readonly string appId;
/// <summary>
/// The _app secret.
/// </summary>
- private readonly string _appSecret;
+ private readonly string appSecret;
#endregion
@@ -50,17 +50,13 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="appSecret">
/// The app secret.
/// </param>
- /// <exception cref="ArgumentNullException">
- /// </exception>
- /// <exception cref="ArgumentNullException">
- /// </exception>
public WindowsLiveClient(string appId, string appSecret)
: base("windowslive") {
Requires.NotNullOrEmpty(appId, "appId");
Requires.NotNullOrEmpty(appSecret, "appSecret");
- this._appId = appId;
- this._appSecret = appSecret;
+ this.appId = appId;
+ this.appSecret = appSecret;
}
#endregion
@@ -70,17 +66,18 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <summary>
/// Gets the full url pointing to the login page for this client. The url should include the specified return url so that when the login completes, user is redirected back to that url.
/// </summary>
- /// <param name="returnUrl">
- /// The return URL.
- /// </param>
+ /// <param name="returnUrl">The return URL.</param>
+ /// <returns>
+ /// An absolute URL.
+ /// </returns>
protected override Uri GetServiceLoginUrl(Uri returnUrl) {
var builder = new UriBuilder(AuthorizationEndpoint);
builder.AppendQueryArgs(
new Dictionary<string, string> {
- { "client_id", this._appId },
- { "scope", "wl.basic" },
- { "response_type", "code" },
- { "redirect_uri", returnUrl.AbsoluteUri },
+ { "client_id", this.appId },
+ { "scope", "wl.basic" },
+ { "response_type", "code" },
+ { "redirect_uri", returnUrl.AbsoluteUri },
});
return builder.Uri;
@@ -133,11 +130,11 @@ namespace DotNetOpenAuth.AspNet.Clients {
var entity =
MessagingUtilities.CreateQueryString(
new Dictionary<string, string> {
- { "client_id", this._appId },
- { "redirect_uri", returnUrl.AbsoluteUri },
- { "client_secret", this._appSecret },
- { "code", authorizationCode },
- { "grant_type", "authorization_code" },
+ { "client_id", this.appId },
+ { "redirect_uri", returnUrl.AbsoluteUri },
+ { "client_secret", this.appSecret },
+ { "code", authorizationCode },
+ { "grant_type", "authorization_code" },
});
WebRequest tokenRequest = WebRequest.Create(TokenEndpoint);
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs
index 9650e3d..34531c0 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs
@@ -19,7 +19,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// Initializes a new instance of the <see cref="GoogleOpenIdClient"/> class.
/// </summary>
public GoogleOpenIdClient()
- : base("google", "https://www.google.com/accounts/o8/id") {}
+ : base("google", "https://www.google.com/accounts/o8/id") { }
#endregion
@@ -31,8 +31,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="response">
/// The response message.
/// </param>
- /// <returns>
- /// </returns>
+ /// <returns>A dictionary of profile data; or null if no data is available.</returns>
protected override Dictionary<string, string> GetExtraData(IAuthenticationResponse response) {
FetchResponse fetchResponse = response.GetExtension<FetchResponse>();
if (fetchResponse != null) {
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs
index a462e90..2ed5220 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs
@@ -9,6 +9,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Web;
+ using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.RelyingParty;
@@ -139,8 +140,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="response">
/// The response message.
/// </param>
- /// <returns>
- /// </returns>
+ /// <returns>Always null.</returns>
protected virtual Dictionary<string, string> GetExtraData(IAuthenticationResponse response) {
return null;
}
@@ -152,6 +152,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// The request.
/// </param>
protected virtual void OnBeforeSendingAuthenticationRequest(IAuthenticationRequest request) { }
+
#endregion
}
}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs
index 67cb8c4..fd5f847 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs
@@ -19,7 +19,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// Initializes a new instance of the <see cref="YahooOpenIdClient"/> class.
/// </summary>
public YahooOpenIdClient()
- : base("yahoo", "http://me.yahoo.com") {}
+ : base("yahoo", "http://me.yahoo.com") { }
#endregion
@@ -31,8 +31,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="response">
/// The response message.
/// </param>
- /// <returns>
- /// </returns>
+ /// <returns>A dictionary of profile data; or null if no data is available.</returns>
protected override Dictionary<string, string> GetExtraData(IAuthenticationResponse response) {
FetchResponse fetchResponse = response.GetExtension<FetchResponse>();
if (fetchResponse != null) {
diff --git a/src/DotNetOpenAuth.AspNet/DotNetOpenAuth.AspNet.csproj b/src/DotNetOpenAuth.AspNet/DotNetOpenAuth.AspNet.csproj
index aacb8f3..f28f96f 100644
--- a/src/DotNetOpenAuth.AspNet/DotNetOpenAuth.AspNet.csproj
+++ b/src/DotNetOpenAuth.AspNet/DotNetOpenAuth.AspNet.csproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))\EnlistmentInfo.props" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))' != '' " />
<PropertyGroup>
- <StyleCopEnabled>False</StyleCopEnabled>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
diff --git a/src/DotNetOpenAuth.AspNet/IOpenAuthDataProvider.cs b/src/DotNetOpenAuth.AspNet/IOpenAuthDataProvider.cs
index 9b3f8c2..12d929d 100644
--- a/src/DotNetOpenAuth.AspNet/IOpenAuthDataProvider.cs
+++ b/src/DotNetOpenAuth.AspNet/IOpenAuthDataProvider.cs
@@ -6,24 +6,25 @@
namespace DotNetOpenAuth.AspNet {
/// <summary>
- /// The i open auth data provider.
+ /// Common methods available on identity issuers.
/// </summary>
public interface IOpenAuthDataProvider {
#region Public Methods and Operators
/// <summary>
- /// The get user name from open auth.
+ /// Get a user name from an identity provider and their own assigned user ID.
/// </summary>
/// <param name="openAuthProvider">
- /// The open auth provider.
+ /// The identity provider.
/// </param>
/// <param name="openAuthId">
- /// The open auth id.
+ /// The issuer's ID for the user.
/// </param>
/// <returns>
- /// The get user name from open auth.
+ /// The username of the user.
/// </returns>
string GetUserNameFromOpenAuth(string openAuthProvider, string openAuthId);
+
#endregion
}
}
diff --git a/src/DotNetOpenAuth.AspNet/OpenAuthAuthenticationTicketHelper.cs b/src/DotNetOpenAuth.AspNet/OpenAuthAuthenticationTicketHelper.cs
index 220d1d0..3fc3a21 100644
--- a/src/DotNetOpenAuth.AspNet/OpenAuthAuthenticationTicketHelper.cs
+++ b/src/DotNetOpenAuth.AspNet/OpenAuthAuthenticationTicketHelper.cs
@@ -26,14 +26,12 @@ namespace DotNetOpenAuth.AspNet {
#region Public Methods and Operators
/// <summary>
- /// The is valid authentication ticket.
+ /// Checks whether the specified HTTP request comes from an authenticated user.
/// </summary>
/// <param name="context">
/// The context.
/// </param>
- /// <returns>
- /// The is valid authentication ticket.
- /// </returns>
+ /// <returns>True if the reuest is authenticated; false otherwise.</returns>
public static bool IsValidAuthenticationTicket(HttpContextBase context) {
HttpCookie cookie = context.Request.Cookies[FormsAuthentication.FormsCookieName];
if (cookie == null) {
@@ -54,7 +52,7 @@ namespace DotNetOpenAuth.AspNet {
}
/// <summary>
- /// The set authentication ticket.
+ /// Adds an authentication cookie to the user agent in the next HTTP response.
/// </summary>
/// <param name="context">
/// The context.
@@ -63,10 +61,8 @@ namespace DotNetOpenAuth.AspNet {
/// The user name.
/// </param>
/// <param name="createPersistentCookie">
- /// The create persistent cookie.
+ /// A value indicating whether the cookie should persist across sessions.
/// </param>
- /// <exception cref="HttpException">
- /// </exception>
public static void SetAuthenticationTicket(HttpContextBase context, string userName, bool createPersistentCookie) {
if (!context.Request.IsSecureConnection && FormsAuthentication.RequireSSL) {
throw new HttpException(WebResources.ConnectionNotSecure);
@@ -81,20 +77,17 @@ namespace DotNetOpenAuth.AspNet {
#region Methods
/// <summary>
- /// The get auth cookie.
+ /// Creates an HTTP authentication cookie.
/// </summary>
/// <param name="userName">
/// The user name.
/// </param>
/// <param name="createPersistentCookie">
- /// The create persistent cookie.
+ /// A value indicating whether the cookie should last across sessions.
/// </param>
- /// <returns>
- /// </returns>
- /// <exception cref="HttpException">
- /// </exception>
+ /// <returns>An authentication cookie.</returns>
private static HttpCookie GetAuthCookie(string userName, bool createPersistentCookie) {
- Debug.Assert(!string.IsNullOrEmpty(userName));
+ Requires.NotNullOrEmpty(userName, "userName");
var ticket = new FormsAuthenticationTicket(
/* version */
diff --git a/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs b/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs
index 01d8c90..463f056 100644
--- a/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs
+++ b/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs
@@ -24,17 +24,17 @@ namespace DotNetOpenAuth.AspNet {
/// <summary>
/// The _authentication provider.
/// </summary>
- private readonly IAuthenticationClient _authenticationProvider;
+ private readonly IAuthenticationClient authenticationProvider;
/// <summary>
/// The _data provider.
/// </summary>
- private readonly IOpenAuthDataProvider _dataProvider;
+ private readonly IOpenAuthDataProvider dataProvider;
/// <summary>
/// The _request context.
/// </summary>
- private readonly HttpContextBase _requestContext;
+ private readonly HttpContextBase requestContext;
#endregion
@@ -47,7 +47,7 @@ namespace DotNetOpenAuth.AspNet {
/// The request context.
/// </param>
public OpenAuthSecurityManager(HttpContextBase requestContext)
- : this(requestContext, provider: null, dataProvider: null) {}
+ : this(requestContext, provider: null, dataProvider: null) { }
/// <summary>
/// Initializes a new instance of the <see cref="OpenAuthSecurityManager"/> class.
@@ -67,9 +67,9 @@ namespace DotNetOpenAuth.AspNet {
throw new ArgumentNullException("requestContext");
}
- this._requestContext = requestContext;
- this._dataProvider = dataProvider;
- this._authenticationProvider = provider;
+ this.requestContext = requestContext;
+ this.dataProvider = dataProvider;
+ this.authenticationProvider = provider;
}
#endregion
@@ -81,8 +81,8 @@ namespace DotNetOpenAuth.AspNet {
/// </summary>
public bool IsAuthenticatedWithOpenAuth {
get {
- return this._requestContext.Request.IsAuthenticated
- && OpenAuthAuthenticationTicketHelper.IsValidAuthenticationTicket(this._requestContext);
+ return this.requestContext.Request.IsAuthenticated
+ && OpenAuthAuthenticationTicketHelper.IsValidAuthenticationTicket(this.requestContext);
}
}
@@ -91,13 +91,13 @@ namespace DotNetOpenAuth.AspNet {
#region Public Methods and Operators
/// <summary>
- /// The get provider name.
+ /// Gets the provider that is responding to an authentication request.
/// </summary>
/// <param name="context">
- /// The context.
+ /// The HTTP request context.
/// </param>
/// <returns>
- /// The get provider name.
+ /// The provider name, if one is available.
/// </returns>
public static string GetProviderName(HttpContextBase context) {
return context.Request.QueryString[ProviderQueryStringName];
@@ -115,16 +115,16 @@ namespace DotNetOpenAuth.AspNet {
/// <returns>
/// <c>true</c> if the login is successful.
/// </returns>
- [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Login",
+ [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Login",
Justification = "Login is used more consistently in ASP.Net")]
public bool Login(string providerUserId, bool createPersistentCookie) {
- string userName = this._dataProvider.GetUserNameFromOpenAuth(
- this._authenticationProvider.ProviderName, providerUserId);
+ string userName = this.dataProvider.GetUserNameFromOpenAuth(
+ this.authenticationProvider.ProviderName, providerUserId);
if (string.IsNullOrEmpty(userName)) {
return false;
}
- OpenAuthAuthenticationTicketHelper.SetAuthenticationTicket(this._requestContext, userName, createPersistentCookie);
+ OpenAuthAuthenticationTicketHelper.SetAuthenticationTicket(this.requestContext, userName, createPersistentCookie);
return true;
}
@@ -138,31 +138,30 @@ namespace DotNetOpenAuth.AspNet {
// convert returnUrl to an absolute path
Uri uri;
if (!string.IsNullOrEmpty(returnUrl)) {
- uri = UriHelper.ConvertToAbsoluteUri(returnUrl, this._requestContext);
+ uri = UriHelper.ConvertToAbsoluteUri(returnUrl, this.requestContext);
} else {
- uri = this._requestContext.Request.GetPublicFacingUrl();
+ uri = this.requestContext.Request.GetPublicFacingUrl();
}
// attach the provider parameter so that we know which provider initiated
// the login when user is redirected back to this page
- uri = uri.AttachQueryStringParameter(ProviderQueryStringName, this._authenticationProvider.ProviderName);
- this._authenticationProvider.RequestAuthentication(this._requestContext, uri);
+ uri = uri.AttachQueryStringParameter(ProviderQueryStringName, this.authenticationProvider.ProviderName);
+ this.authenticationProvider.RequestAuthentication(this.requestContext, uri);
}
/// <summary>
/// Checks if user is successfully authenticated when user is redirected back to this user.
/// </summary>
- /// <returns>
- /// </returns>
+ /// <returns>The result of the authentication.</returns>
public AuthenticationResult VerifyAuthentication() {
- AuthenticationResult result = this._authenticationProvider.VerifyAuthentication(this._requestContext);
+ AuthenticationResult result = this.authenticationProvider.VerifyAuthentication(this.requestContext);
if (!result.IsSuccessful) {
// if the result is a Failed result, creates a new Failed response which has providerName info.
result = new AuthenticationResult(
- isSuccessful: false,
- provider: this._authenticationProvider.ProviderName,
- providerUserId: null,
- userName: null,
+ isSuccessful: false,
+ provider: this.authenticationProvider.ProviderName,
+ providerUserId: null,
+ userName: null,
extraData: null);
}
diff --git a/src/DotNetOpenAuth.AspNet/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.AspNet/Properties/AssemblyInfo.cs
index 6640257..15b7d9e 100644
--- a/src/DotNetOpenAuth.AspNet/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.AspNet/Properties/AssemblyInfo.cs
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
-// <copyright file="AssemblyInfo.cs" company="">
-//
+// <copyright file="AssemblyInfo.cs" company="Microsoft">
+// Copyright (c) Microsoft. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
@@ -34,10 +34,7 @@ using System.Runtime.InteropServices;
#if StrongNameSigned
-[assembly:
- InternalsVisibleTo(
- "DotNetOpenAuth.AspNet.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100AD093C3765257C89A7010E853F2C7C741FF92FA8ACE06D7B8254702CAD5CF99104447F63AB05F8BB6F51CE0D81C8C93D2FCE8C20AAFF7042E721CBA16EAAE98778611DED11C0ABC8900DC5667F99B50A9DADEC24DBD8F2C91E3E8AD300EF64F1B4B9536CEB16FB440AF939F57624A9B486F867807C649AE4830EAB88C6C03998"
- )]
+[assembly: InternalsVisibleTo("DotNetOpenAuth.AspNet.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100AD093C3765257C89A7010E853F2C7C741FF92FA8ACE06D7B8254702CAD5CF99104447F63AB05F8BB6F51CE0D81C8C93D2FCE8C20AAFF7042E721CBA16EAAE98778611DED11C0ABC8900DC5667F99B50A9DADEC24DBD8F2C91E3E8AD300EF64F1B4B9536CEB16FB440AF939F57624A9B486F867807C649AE4830EAB88C6C03998")]
#else
[assembly: InternalsVisibleTo("DotNetOpenAuth.AspNet.Test")]
#endif
diff --git a/src/DotNetOpenAuth.AspNet/UriHelper.cs b/src/DotNetOpenAuth.AspNet/UriHelper.cs
index 2c6e5a9..06b8bc8 100644
--- a/src/DotNetOpenAuth.AspNet/UriHelper.cs
+++ b/src/DotNetOpenAuth.AspNet/UriHelper.cs
@@ -28,8 +28,7 @@ namespace DotNetOpenAuth.AspNet {
/// <param name="parameterValue">
/// The parameter value.
/// </param>
- /// <returns>
- /// </returns>
+ /// <returns>An absolute URI.</returns>
public static Uri AttachQueryStringParameter(this Uri url, string parameterName, string parameterValue) {
UriBuilder builder = new UriBuilder(url);
string query = builder.Query;
@@ -65,8 +64,7 @@ namespace DotNetOpenAuth.AspNet {
/// <param name="context">
/// The context.
/// </param>
- /// <returns>
- /// </returns>
+ /// <returns>An absolute URI.</returns>
public static Uri ConvertToAbsoluteUri(string returnUrl, HttpContextBase context) {
if (Uri.IsWellFormedUriString(returnUrl, UriKind.Absolute)) {
return new Uri(returnUrl, UriKind.Absolute);