summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.AspNet
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.AspNet')
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs7
-rw-r--r--src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs31
2 files changed, 22 insertions, 16 deletions
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs
index faea868..653a0b0 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs
@@ -71,6 +71,13 @@ namespace DotNetOpenAuth.AspNet.Clients {
#endregion
+ /// <summary>
+ /// Gets the identifier for this client as it is registered with Microsoft.
+ /// </summary>
+ protected string AppId {
+ get { return this.appId; }
+ }
+
#region Methods
/// <summary>
diff --git a/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs b/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs
index 2d18b7b..caada35 100644
--- a/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs
+++ b/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs
@@ -64,18 +64,22 @@ namespace DotNetOpenAuth.AspNet {
/// <param name="requestContext">
/// The request context.
/// </param>
+ public OpenAuthSecurityManager(HttpContextBase requestContext)
+ : this(requestContext, provider: null, dataProvider: null) { }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="OpenAuthSecurityManager"/> class.
+ /// </summary>
+ /// <param name="requestContext">
+ /// The request context.
+ /// </param>
/// <param name="provider">
/// The provider.
/// </param>
/// <param name="dataProvider">
/// The data provider.
/// </param>
- public OpenAuthSecurityManager(
- HttpContextBase requestContext, IAuthenticationClient provider, IOpenAuthDataProvider dataProvider) {
- Requires.NotNull(requestContext, "requestContext");
- Requires.NotNull(provider, "provider");
- Requires.NotNull(dataProvider, "dataProvider");
-
+ public OpenAuthSecurityManager(HttpContextBase requestContext, IAuthenticationClient provider, IOpenAuthDataProvider dataProvider) {
this.requestContext = requestContext;
this.dataProvider = dataProvider;
this.authenticationProvider = provider;
@@ -148,8 +152,7 @@ namespace DotNetOpenAuth.AspNet {
Uri uri;
if (!string.IsNullOrEmpty(returnUrl)) {
uri = UriHelper.ConvertToAbsoluteUri(returnUrl, this.requestContext);
- }
- else {
+ } else {
uri = this.requestContext.Request.GetPublicFacingUrl();
}
@@ -208,8 +211,7 @@ namespace DotNetOpenAuth.AspNet {
Uri uri;
if (!string.IsNullOrEmpty(returnUrl)) {
uri = UriHelper.ConvertToAbsoluteUri(returnUrl, this.requestContext);
- }
- else {
+ } else {
uri = this.requestContext.Request.GetPublicFacingUrl();
}
@@ -234,12 +236,10 @@ namespace DotNetOpenAuth.AspNet {
}
return result;
- }
- catch (HttpException exception) {
+ } catch (HttpException exception) {
return new AuthenticationResult(exception.GetBaseException(), this.authenticationProvider.ProviderName);
}
- }
- else {
+ } else {
return this.authenticationProvider.VerifyAuthentication(this.requestContext);
}
}
@@ -289,8 +289,7 @@ namespace DotNetOpenAuth.AspNet {
byte[] encryptedCookieBytes = HttpServerUtility.UrlTokenDecode(cookie.Value);
byte[] decryptedCookieBytes = MachineKeyUtil.Unprotect(encryptedCookieBytes, AntiXsrfPurposeString, "Token: " + queryStringSessionId);
usernameInCookie = Encoding.UTF8.GetString(decryptedCookieBytes);
- }
- catch {
+ } catch {
return false;
}