summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2013-06-16 16:50:45 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2013-06-16 16:50:45 -0700
commit89c2167a677ebb23aca7f1e9592af7954a093fff (patch)
tree37c513a0cfae1cee641051d345b6cbffd5216538 /src
parentc74bede6f773bd0a0c6362a6647a2939554ccd9a (diff)
downloadDotNetOpenAuth-89c2167a677ebb23aca7f1e9592af7954a093fff.zip
DotNetOpenAuth-89c2167a677ebb23aca7f1e9592af7954a093fff.tar.gz
DotNetOpenAuth-89c2167a677ebb23aca7f1e9592af7954a093fff.tar.bz2
Removes Microsoft AspNet project.
Compatibility with it is broken due to the async changes in DNOA.
Diffstat (limited to 'src')
-rw-r--r--src/DotNetOpenAuth.AspNet.Test/DotNetOpenAuth.AspNet.Test.csproj92
-rw-r--r--src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs142
-rw-r--r--src/DotNetOpenAuth.AspNet.Test/OAuthAuthenticationTickerHelperTest.cs146
-rw-r--r--src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs145
-rw-r--r--src/DotNetOpenAuth.AspNet.Test/Properties/AssemblyInfo.cs23
-rw-r--r--src/DotNetOpenAuth.AspNet.Test/Settings.StyleCop48
-rw-r--r--src/DotNetOpenAuth.AspNet.Test/UriHelperTest.cs43
-rw-r--r--src/DotNetOpenAuth.AspNet.Test/packages.config5
-rw-r--r--src/DotNetOpenAuth.AspNet/AuthenticationResult.cs122
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs59
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs105
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs47
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs105
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs162
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs101
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADClaims.cs75
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADClient.cs460
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADGraph.cs61
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADHeader.cs49
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs201
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookGraphData.cs68
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/JsonHelper.cs38
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs200
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClientUserData.cs66
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2AccessTokenData.cs46
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs174
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/WindowsLiveClient.cs28
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs70
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs158
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs66
-rw-r--r--src/DotNetOpenAuth.AspNet/DotNetOpenAuth.AspNet.csproj119
-rw-r--r--src/DotNetOpenAuth.AspNet/IAuthenticationClient.cs41
-rw-r--r--src/DotNetOpenAuth.AspNet/IOpenAuthDataProvider.cs30
-rw-r--r--src/DotNetOpenAuth.AspNet/OpenAuthAuthenticationTicketHelper.cs133
-rw-r--r--src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs321
-rw-r--r--src/DotNetOpenAuth.AspNet/Properties/AssemblyInfo.cs33
-rw-r--r--src/DotNetOpenAuth.AspNet/UriHelper.cs80
-rw-r--r--src/DotNetOpenAuth.AspNet/WebResources.Designer.cs108
-rw-r--r--src/DotNetOpenAuth.AspNet/WebResources.resx135
-rw-r--r--src/DotNetOpenAuth.AspNet/packages.config5
-rw-r--r--src/DotNetOpenAuth.sln16
41 files changed, 0 insertions, 4126 deletions
diff --git a/src/DotNetOpenAuth.AspNet.Test/DotNetOpenAuth.AspNet.Test.csproj b/src/DotNetOpenAuth.AspNet.Test/DotNetOpenAuth.AspNet.Test.csproj
deleted file mode 100644
index e640992..0000000
--- a/src/DotNetOpenAuth.AspNet.Test/DotNetOpenAuth.AspNet.Test.csproj
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<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>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{C23B217B-4D35-4A72-A1F7-FAEB4F39CB91}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>DotNetOpenAuth.AspNet.Test</RootNamespace>
- <AssemblyName>DotNetOpenAuth.AspNet.Test</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.props" />
- <PropertyGroup>
- <DelaySign>true</DelaySign>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Moq">
- <HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
- </Reference>
- <Reference Include="nunit.framework, Version=2.6.1.12217, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\NUnit.2.6.1\lib\nunit.framework.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Web" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="OAuth2ClientTest.cs" />
- <Compile Include="OAuthAuthenticationTickerHelperTest.cs" />
- <Compile Include="OAuthClientTest.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="UriHelperTest.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\DotNetOpenAuth.Core\DotNetOpenAuth.Core.csproj">
- <Project>{60426312-6AE5-4835-8667-37EDEA670222}</Project>
- <Name>DotNetOpenAuth.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\DotNetOpenAuth.OAuth.Common\DotNetOpenAuth.OAuth.Common.csproj">
- <Project>{115217c5-22cd-415c-a292-0dd0238cdd89}</Project>
- <Name>DotNetOpenAuth.OAuth.Common</Name>
- </ProjectReference>
- <ProjectReference Include="..\DotNetOpenAuth.OAuth.Consumer\DotNetOpenAuth.OAuth.Consumer.csproj">
- <Project>{b202e40d-4663-4a2b-acda-865f88ff7caa}</Project>
- <Name>DotNetOpenAuth.OAuth.Consumer</Name>
- </ProjectReference>
- <ProjectReference Include="..\DotNetOpenAuth.OAuth\DotNetOpenAuth.OAuth.csproj">
- <Project>{A288FCC8-6FCF-46DA-A45E-5F9281556361}</Project>
- <Name>DotNetOpenAuth.OAuth</Name>
- </ProjectReference>
- <ProjectReference Include="..\DotNetOpenAuth.AspNet\DotNetOpenAuth.AspNet.csproj">
- <Project>{51835086-9611-4C53-819B-F2D5C9320873}</Project>
- <Name>DotNetOpenAuth.AspNet</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.targets" />
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))\EnlistmentInfo.targets" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))' != '' " />
- <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
-</Project> \ No newline at end of file
diff --git a/src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs b/src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs
deleted file mode 100644
index cfb0552..0000000
--- a/src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OAuth2ClientTest.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Test {
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Threading.Tasks;
- using System.Web;
- using DotNetOpenAuth.AspNet.Clients;
- using Moq;
- using NUnit.Framework;
-
- [TestFixture]
- public class OAuth2ClientTest {
- [TestCase]
- public void TestProviderName() {
- // Arrange
- var client = new MockOAuth2Client();
-
- // Act
- string providerName = client.ProviderName;
-
- // Assert
- Assert.AreEqual("mockprovider", providerName);
- }
-
- [TestCase]
- public async Task RequestAuthenticationIssueCorrectRedirect() {
- // Arrange
- var client = new MockOAuth2Client();
- var context = new Mock<HttpContextBase>(MockBehavior.Strict);
- context.Setup(c => c.Response.Redirect("http://live.com/?q=http://return.to.me/", true)).Verifiable();
-
- // Act
- await client.RequestAuthenticationAsync(context.Object, new Uri("http://return.to.me"));
-
- // Assert
- context.Verify();
- }
-
- [TestCase]
- public void VerifyAuthenticationThrowsIfContextIsNull() {
- // Arrange
- var client = new MockOAuth2Client();
-
- // Act && Assert
- Assert.Throws<ArgumentNullException>(() => client.VerifyAuthenticationAsync(null, new Uri("http://me.com")).GetAwaiter().GetResult());
- }
-
- [TestCase]
- public void VerifyAuthenticationWithoutReturnUrlThrows() {
- // Arrange
- var client = new MockOAuth2Client();
-
- // Act && Assert
- Assert.Throws<InvalidOperationException>(() => client.VerifyAuthenticationAsync(new Mock<HttpContextBase>().Object).GetAwaiter().GetResult());
- }
-
- [TestCase]
- public async Task VerifyAuthenticationFailsIfCodeIsNotPresent() {
- // Arrange
- var client = new MockOAuth2Client();
- var context = new Mock<HttpContextBase>(MockBehavior.Strict);
- var queryStrings = new NameValueCollection();
- context.Setup(c => c.Request.QueryString).Returns(queryStrings);
-
- // Act
- AuthenticationResult result = await client.VerifyAuthenticationAsync(context.Object, new Uri("http://me.com"));
-
- // Assert
- Assert.IsFalse(result.IsSuccessful);
- }
-
- [TestCase]
- public async Task VerifyAuthenticationFailsIfAccessTokenIsNull() {
- // Arrange
- var client = new MockOAuth2Client();
- var context = new Mock<HttpContextBase>(MockBehavior.Strict);
- var queryStrings = new NameValueCollection();
- queryStrings.Add("code", "random");
- context.Setup(c => c.Request.QueryString).Returns(queryStrings);
-
- // Act
- AuthenticationResult result = await client.VerifyAuthenticationAsync(context.Object, new Uri("http://me.com"));
-
- // Assert
- Assert.IsFalse(result.IsSuccessful);
- }
-
- [TestCase]
- public async Task VerifyAuthenticationSucceeds() {
- // Arrange
- var client = new MockOAuth2Client();
- var context = new Mock<HttpContextBase>(MockBehavior.Strict);
- var queryStrings = new NameValueCollection();
- queryStrings.Add("code", "secret");
- context.Setup(c => c.Request.QueryString).Returns(queryStrings);
-
- // Act
- AuthenticationResult result = await client.VerifyAuthenticationAsync(context.Object, new Uri("http://me.com"));
-
- // Assert
- Assert.True(result.IsSuccessful);
- Assert.AreEqual("mockprovider", result.Provider);
- Assert.AreEqual("12345", result.ProviderUserId);
- Assert.AreEqual("John Doe", result.UserName);
- Assert.NotNull(result.ExtraData);
- Assert.AreEqual("abcde", result.ExtraData["accesstoken"]);
- }
-
- private class MockOAuth2Client : OAuth2Client {
- public MockOAuth2Client()
- : base("mockprovider") {
- }
-
- protected override Uri GetServiceLoginUrl(Uri returnUrl) {
- string url = "http://live.com/?q=" + returnUrl.ToString();
- return new Uri(url);
- }
-
- protected override string QueryAccessToken(Uri returnUrl, string authorizationCode) {
- return (authorizationCode == "secret") ? "abcde" : null;
- }
-
- protected override NameValueCollection GetUserData(string accessToken) {
- if (accessToken == "abcde") {
- return new NameValueCollection
- {
- { "id", "12345" },
- { "name", "John Doe" },
- };
- }
-
- return null;
- }
- }
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet.Test/OAuthAuthenticationTickerHelperTest.cs b/src/DotNetOpenAuth.AspNet.Test/OAuthAuthenticationTickerHelperTest.cs
deleted file mode 100644
index 676a550..0000000
--- a/src/DotNetOpenAuth.AspNet.Test/OAuthAuthenticationTickerHelperTest.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OAuthAuthenticationTickerHelperTest.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.Test.Web {
- using System;
- using System.Web;
- using System.Web.Security;
- using DotNetOpenAuth.AspNet;
- using Moq;
- using NUnit.Framework;
-
- [TestFixture]
- public class OAuthAuthenticationTickerHelperTest {
- [TestCase]
- public void SetAuthenticationTicketSetCookieOnHttpResponseWithPersistentSet() {
- this.SetAuthenticationTicketSetCookieOnHttpResponse(isPersistent: true);
- }
-
- [TestCase]
- public void SetAuthenticationTicketSetCookieOnHttpResponseWithPersistentNotSet() {
- this.SetAuthenticationTicketSetCookieOnHttpResponse(isPersistent: false);
- }
-
- [TestCase]
- public void IsOAuthAuthenticationTicketReturnsTrueIfCookieIsPresent() {
- // Arrange
- var ticket = new FormsAuthenticationTicket(
- 2,
- "username",
- DateTime.Now,
- DateTime.Now.Add(FormsAuthentication.Timeout),
- false,
- "OAuth",
- FormsAuthentication.FormsCookiePath);
-
- var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket));
- var cookies = new HttpCookieCollection { cookie };
-
- var context = new Mock<HttpContextBase>();
- context.Setup(c => c.Request.Cookies).Returns(cookies);
-
- // Act
- bool result = OpenAuthAuthenticationTicketHelper.IsValidAuthenticationTicket(context.Object);
-
- // Assert
- Assert.IsTrue(result);
- }
-
- [TestCase]
- public void IsOAuthAuthenticationTicketReturnsFalseIfCookieIsNotPresent() {
- // Arrange
- var context = new Mock<HttpContextBase>();
- context.Setup(c => c.Request.Cookies).Returns(new HttpCookieCollection());
-
- // Act
- bool result = OpenAuthAuthenticationTicketHelper.IsValidAuthenticationTicket(context.Object);
-
- // Assert
- Assert.IsFalse(result);
- }
-
- [TestCase]
- public void IsOAuthAuthenticationTicketReturnsFalseIfCookieIsPresentButDoesNotHaveOAuthData() {
- // Arrange
- var ticket = new FormsAuthenticationTicket(
- 2,
- "username",
- DateTime.Now,
- DateTime.Now.Add(FormsAuthentication.Timeout),
- false,
- null,
- FormsAuthentication.FormsCookiePath);
-
- var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket));
- var cookies = new HttpCookieCollection { cookie };
-
- var context = new Mock<HttpContextBase>();
- context.Setup(c => c.Request.Cookies).Returns(cookies);
-
- // Act
- bool result = OpenAuthAuthenticationTicketHelper.IsValidAuthenticationTicket(context.Object);
-
- // Assert
- Assert.IsFalse(result);
- }
-
- [TestCase]
- public void IsOAuthAuthenticationTicketReturnsFalseIfCookieIsPresentButDoesNotHaveCorrectName() {
- // Arrange
- var response = new Mock<HttpResponseBase>();
-
- var ticket = new FormsAuthenticationTicket(
- 2,
- "username",
- DateTime.Now,
- DateTime.Now.Add(FormsAuthentication.Timeout),
- false,
- "OAuth",
- FormsAuthentication.FormsCookiePath);
-
- var cookie = new HttpCookie("random cookie name", FormsAuthentication.Encrypt(ticket));
- var cookies = new HttpCookieCollection { cookie };
-
- var context = new Mock<HttpContextBase>();
- context.Setup(c => c.Request.Cookies).Returns(cookies);
-
- // Act
- bool result = OpenAuthAuthenticationTicketHelper.IsValidAuthenticationTicket(context.Object);
-
- // Assert
- Assert.IsFalse(result);
- }
-
- private void SetAuthenticationTicketSetCookieOnHttpResponse(bool isPersistent) {
- // Arrange
- var cookies = new HttpCookieCollection();
-
- var context = new Mock<HttpContextBase>();
- context.Setup(c => c.Request.IsSecureConnection).Returns(true);
- context.Setup(c => c.Response.Cookies).Returns(cookies);
-
- // Act
- OpenAuthAuthenticationTicketHelper.SetAuthenticationTicket(context.Object, "user", isPersistent);
-
- // Assert
- Assert.AreEqual(1, cookies.Count);
- HttpCookie addedCookie = cookies[0];
-
- Assert.AreEqual(FormsAuthentication.FormsCookieName, addedCookie.Name);
- Assert.IsTrue(addedCookie.HttpOnly);
- Assert.AreEqual("/", addedCookie.Path);
- Assert.IsFalse(addedCookie.Secure);
- Assert.IsNotNullOrEmpty(addedCookie.Value);
-
- FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(addedCookie.Value);
- Assert.NotNull(ticket);
- Assert.AreEqual(2, ticket.Version);
- Assert.AreEqual("user", ticket.Name);
- Assert.AreEqual("OAuth", ticket.UserData);
- Assert.AreEqual(isPersistent, ticket.IsPersistent);
- }
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs b/src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs
deleted file mode 100644
index d8686ae..0000000
--- a/src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs
+++ /dev/null
@@ -1,145 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OAuthClientTest.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Test {
- using System;
- using System.Collections.Specialized;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Web;
- using DotNetOpenAuth.AspNet;
- using DotNetOpenAuth.AspNet.Clients;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OAuth;
- using DotNetOpenAuth.OAuth.Messages;
- using Moq;
- using NUnit.Framework;
-
- [TestFixture]
- public class OAuthClientTest {
- [TestCase]
- public void TestProviderNamePropertyIsCorrect() {
- // Arrange
- var client = new MockOAuthClient();
-
- // Act
- var provider = client.ProviderName;
-
- // Assert
- Assert.AreEqual("mockoauth", provider);
- }
-
- [TestCase]
- public async Task RequestAuthenticationInvokeMethodOnWebWorker() {
- // Arrange
- var returnUri = new Uri("http://live.com/my/path.cshtml?q=one");
- var webWorker = new Mock<IOAuthWebWorker>(MockBehavior.Strict);
- webWorker
- .Setup(w => w.RequestAuthenticationAsync(returnUri, It.IsAny<CancellationToken>()))
- .Returns(Task.FromResult(new Uri("http://someauth/uri")))
- .Verifiable();
-
- var client = new MockOAuthClient(webWorker.Object);
- var context = new Mock<HttpContextBase>();
-
- // Act
- await client.RequestAuthenticationAsync(context.Object, returnUri);
-
- // Assert
- webWorker.Verify();
- }
-
- [TestCase]
- public async Task VerifyAuthenticationFailsIfResponseTokenIsNull() {
- // Arrange
- var webWorker = new Mock<IOAuthWebWorker>(MockBehavior.Strict);
- webWorker.Setup(w => w.ProcessUserAuthorizationAsync(It.IsAny<HttpContextBase>(), CancellationToken.None)).Returns(Task.FromResult<AccessTokenResponse>(null));
-
- var client = new MockOAuthClient(webWorker.Object);
- var context = new Mock<HttpContextBase>();
-
- // Act
- await client.VerifyAuthenticationAsync(context.Object);
-
- // Assert
- webWorker.Verify();
- }
-
- [TestCase]
- public async Task VerifyAuthenticationFailsIfAccessTokenIsInvalid() {
- // Arrange
- var endpoint = new MessageReceivingEndpoint("http://live.com/path/?a=b", HttpDeliveryMethods.GetRequest);
- var request = new AuthorizedTokenRequest(endpoint, new Version("1.0"));
-
- var webWorker = new Mock<IOAuthWebWorker>(MockBehavior.Strict);
- webWorker.Setup(w => w.ProcessUserAuthorizationAsync(It.IsAny<HttpContextBase>(), CancellationToken.None)).Returns(Task.FromResult<AccessTokenResponse>(null)).Verifiable();
-
- var client = new MockOAuthClient(webWorker.Object);
- var context = new Mock<HttpContextBase>();
-
- // Act
- AuthenticationResult result = await client.VerifyAuthenticationAsync(context.Object);
-
- // Assert
- webWorker.Verify();
-
- Assert.False(result.IsSuccessful);
- }
-
- [TestCase]
- public async Task VerifyAuthenticationSucceeds() {
- // Arrange
- var endpoint = new MessageReceivingEndpoint("http://live.com/path/?a=b", HttpDeliveryMethods.GetRequest);
- var request = new AuthorizedTokenRequest(endpoint, new Version("1.0"));
-
- var webWorker = new Mock<IOAuthWebWorker>(MockBehavior.Strict);
- webWorker
- .Setup(w => w.ProcessUserAuthorizationAsync(It.IsAny<HttpContextBase>(), CancellationToken.None))
- .Returns(Task.FromResult(new AccessTokenResponse("ok", "secret", new NameValueCollection()))).Verifiable();
-
- var client = new MockOAuthClient(webWorker.Object);
- var context = new Mock<HttpContextBase>();
-
- // Act
- AuthenticationResult result = await client.VerifyAuthenticationAsync(context.Object);
-
- // Assert
- webWorker.Verify();
-
- Assert.True(result.IsSuccessful);
- Assert.AreEqual("mockoauth", result.Provider);
- Assert.AreEqual("12345", result.ProviderUserId);
- Assert.AreEqual("super", result.UserName);
- Assert.IsNotNull(result.ExtraData);
- Assert.AreEqual("ok", result.ExtraData["accesstoken"]);
- }
-
- private class MockOAuthClient : OAuthClient {
- /// <summary>
- /// Initializes a new instance of the <see cref="MockOAuthClient"/> class.
- /// </summary>
- public MockOAuthClient()
- : this(new Mock<IOAuthWebWorker>().Object) {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="MockOAuthClient"/> class.
- /// </summary>
- /// <param name="worker">The worker.</param>
- public MockOAuthClient(IOAuthWebWorker worker)
- : base("mockoauth", worker) {
- }
-
- protected override Task<AuthenticationResult> VerifyAuthenticationCoreAsync(AccessTokenResponse response, CancellationToken cancellationToken) {
- if (response.AccessToken.Token == "ok") {
- return Task.FromResult(new AuthenticationResult(true, "mockoauth", "12345", "super", response.ExtraData));
- }
-
- return Task.FromResult(AuthenticationResult.Failed);
- }
- }
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet.Test/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.AspNet.Test/Properties/AssemblyInfo.cs
deleted file mode 100644
index cb15d63..0000000
--- a/src/DotNetOpenAuth.AspNet.Test/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="AssemblyInfo.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("6c32d8f7-1394-40ef-9ec0-b8953adc0a4f")]
diff --git a/src/DotNetOpenAuth.AspNet.Test/Settings.StyleCop b/src/DotNetOpenAuth.AspNet.Test/Settings.StyleCop
deleted file mode 100644
index 63f402c..0000000
--- a/src/DotNetOpenAuth.AspNet.Test/Settings.StyleCop
+++ /dev/null
@@ -1,48 +0,0 @@
-<StyleCopSettings Version="105">
- <Analyzers>
- <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
- <Rules>
- <Rule Name="ElementsMustBeDocumented">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="EnumerationItemsMustBeDocumented">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
- <Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
- <Rules>
- <Rule Name="SingleLineCommentMustBePrecededByBlankLine">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
- <Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
- <AnalyzerSettings>
- <CollectionProperty Name="Hungarian">
- <Value>op</Value>
- <Value>rp</Value>
- <Value>v</Value>
- </CollectionProperty>
- </AnalyzerSettings>
- </Analyzer>
- <Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
- <Rules>
- <Rule Name="FieldsMustBePrivate">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
- </Analyzers>
-</StyleCopSettings> \ No newline at end of file
diff --git a/src/DotNetOpenAuth.AspNet.Test/UriHelperTest.cs b/src/DotNetOpenAuth.AspNet.Test/UriHelperTest.cs
deleted file mode 100644
index db60e17..0000000
--- a/src/DotNetOpenAuth.AspNet.Test/UriHelperTest.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="UriHelperTest.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Test {
- using System;
- using DotNetOpenAuth.AspNet.Clients;
- using NUnit.Framework;
-
- [TestFixture]
- public class UriHelperTest {
- [TestCase]
- public void TestAttachQueryStringParameterMethod() {
- // Arrange
- string[] input = new string[]
- {
- "http://x.com",
- "https://xxx.com/one?s=123",
- "https://yyy.com/?s=6&u=a",
- "https://zzz.com/default.aspx?name=sd"
- };
-
- string[] expectedOutput = new string[]
- {
- "http://x.com/?s=awesome",
- "https://xxx.com/one?s=awesome",
- "https://yyy.com/?s=awesome&u=a",
- "https://zzz.com/default.aspx?name=sd&s=awesome"
- };
-
- for (int i = 0; i < input.Length; i++) {
- // Act
- var inputUrl = new Uri(input[i]);
- var outputUri = UriHelper.AttachQueryStringParameter(inputUrl, "s", "awesome");
-
- // Assert
- Assert.AreEqual(expectedOutput[i], outputUri.ToString());
- }
- }
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet.Test/packages.config b/src/DotNetOpenAuth.AspNet.Test/packages.config
deleted file mode 100644
index 63de7c2..0000000
--- a/src/DotNetOpenAuth.AspNet.Test/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Moq" version="4.0.10827" targetFramework="net45" />
- <package id="NUnit" version="2.6.1" targetFramework="net45" />
-</packages> \ No newline at end of file
diff --git a/src/DotNetOpenAuth.AspNet/AuthenticationResult.cs b/src/DotNetOpenAuth.AspNet/AuthenticationResult.cs
deleted file mode 100644
index c7def96..0000000
--- a/src/DotNetOpenAuth.AspNet/AuthenticationResult.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="AuthenticationResult.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet {
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Diagnostics.CodeAnalysis;
- using DotNetOpenAuth.Messaging;
-
- /// <summary>
- /// Represents the result of OAuth or OpenID authentication.
- /// </summary>
- public class AuthenticationResult {
- /// <summary>
- /// Returns an instance which indicates failed authentication.
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes",
- Justification = "This type is immutable.")]
- public static readonly AuthenticationResult Failed = new AuthenticationResult(isSuccessful: false);
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AuthenticationResult"/> class.
- /// </summary>
- /// <param name="isSuccessful">
- /// if set to <c>true</c> [is successful].
- /// </param>
- public AuthenticationResult(bool isSuccessful)
- : this(isSuccessful, provider: null, providerUserId: null, userName: null, extraData: null) { }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AuthenticationResult"/> class.
- /// </summary>
- /// <param name="exception">
- /// The exception.
- /// </param>
- public AuthenticationResult(Exception exception)
- : this(exception, provider: null) {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AuthenticationResult"/> class.
- /// </summary>
- /// <param name="exception">The exception.</param>
- /// <param name="provider">The provider name.</param>
- public AuthenticationResult(Exception exception, string provider)
- : this(isSuccessful: false) {
- if (exception == null) {
- throw new ArgumentNullException("exception");
- }
-
- this.Error = exception;
- this.Provider = provider;
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AuthenticationResult"/> class.
- /// </summary>
- /// <param name="isSuccessful">
- /// if set to <c>true</c> [is successful].
- /// </param>
- /// <param name="provider">
- /// The provider.
- /// </param>
- /// <param name="providerUserId">
- /// The provider user id.
- /// </param>
- /// <param name="userName">
- /// Name of the user.
- /// </param>
- /// <param name="extraData">
- /// The extra data.
- /// </param>
- public AuthenticationResult(
- bool isSuccessful, string provider, string providerUserId, string userName, NameValueCollection extraData) {
- this.IsSuccessful = isSuccessful;
- this.Provider = provider;
- this.ProviderUserId = providerUserId;
- this.UserName = userName;
- this.ExtraData = extraData ?? new NameValueCollection();
- }
-
- /// <summary>
- /// Gets the error that may have occured during the authentication process
- /// </summary>
- public Exception Error { get; private set; }
-
- /// <summary>
- /// Gets the optional extra data that may be returned from the provider
- /// </summary>
- public NameValueCollection ExtraData { get; private set; }
-
- /// <summary>
- /// Gets a value indicating whether the authentication step is successful.
- /// </summary>
- /// <value> <c>true</c> if authentication is successful; otherwise, <c>false</c> . </value>
- public bool IsSuccessful { get; private set; }
-
- /// <summary>
- /// Gets the provider's name.
- /// </summary>
- public string Provider { get; private set; }
-
- /// <summary>
- /// Gets the user id that is returned from the provider. It is unique only within the Provider's namespace.
- /// </summary>
- public string ProviderUserId { get; private set; }
-
- /// <summary>
- /// Gets an (insecure, non-unique) alias for the user that the user should recognize as himself/herself.
- /// </summary>
- /// <value>This may take the form of an email address, a URL, or any other value that the user may recognize.</value>
- /// <remarks>
- /// This alias may come from the Provider or may be derived by the relying party if the Provider does not supply one.
- /// It is not guaranteed to be unique and certainly does not merit any trust in any suggested authenticity.
- /// </remarks>
- public string UserName { get; private set; }
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs b/src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs
deleted file mode 100644
index a84fdcf..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="DictionaryExtensions.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Xml.Linq;
-
- /// <summary>
- /// The dictionary extensions.
- /// </summary>
- internal static class DictionaryExtensions {
- /// <summary>
- /// Adds the value from an XDocument with the specified element name if it's not empty.
- /// </summary>
- /// <param name="dictionary">
- /// The dictionary.
- /// </param>
- /// <param name="document">
- /// The document.
- /// </param>
- /// <param name="elementName">
- /// Name of the element.
- /// </param>
- internal static void AddDataIfNotEmpty(
- this NameValueCollection dictionary, XDocument document, string elementName) {
- var element = document.Root.Element(elementName);
- if (element != null) {
- dictionary.AddItemIfNotEmpty(elementName, element.Value);
- }
- }
-
- /// <summary>
- /// Adds a key/value pair to the specified dictionary if the value is not null or empty.
- /// </summary>
- /// <param name="dictionary">
- /// The dictionary.
- /// </param>
- /// <param name="key">
- /// The key.
- /// </param>
- /// <param name="value">
- /// The value.
- /// </param>
- internal static void AddItemIfNotEmpty(this NameValueCollection dictionary, string key, string value) {
- if (key == null) {
- throw new ArgumentNullException("key");
- }
-
- if (!string.IsNullOrEmpty(value)) {
- dictionary[key] = value;
- }
- }
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs
deleted file mode 100644
index 3a7d60f..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="DotNetOpenAuthWebConsumer.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.Collections.Generic;
- using System.Net;
- using System.Net.Http;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Web;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OAuth;
- using DotNetOpenAuth.OAuth.ChannelElements;
- using DotNetOpenAuth.OAuth.Messages;
- using Validation;
-
- /// <summary>
- /// The dot net open auth web consumer.
- /// </summary>
- public class DotNetOpenAuthWebConsumer : IOAuthWebWorker {
- #region Constants and Fields
-
- /// <summary>
- /// The _web consumer.
- /// </summary>
- private readonly Consumer webConsumer;
-
- #endregion
-
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="DotNetOpenAuthWebConsumer" /> class.
- /// </summary>
- /// <param name="serviceDescription">The service description.</param>
- /// <param name="consumerKey">The consumer key.</param>
- /// <param name="consumerSecret">The consumer secret.</param>
- public DotNetOpenAuthWebConsumer(ServiceProviderDescription serviceDescription, string consumerKey, string consumerSecret) {
- Requires.NotNull(serviceDescription, "serviceDescription");
-
- this.webConsumer = new Consumer {
- ServiceProvider = serviceDescription,
- ConsumerKey = consumerKey,
- ConsumerSecret = consumerSecret,
- TemporaryCredentialStorage = new CookieTemporaryCredentialStorage(),
- };
- }
-
- #endregion
-
- /// <summary>
- /// Gets the DotNetOpenAuth <see cref="Consumer"/> instance that can be used to make OAuth 1.0 authorized HTTP requests.
- /// </summary>
- public Consumer Consumer {
- get { return this.webConsumer; }
- }
-
- #region Public Methods and Operators
-
- /// <summary>
- /// Creates an HTTP message handler that authorizes outgoing web requests.
- /// </summary>
- /// <param name="accessToken">The access token.</param>
- /// <returns>An <see cref="HttpMessageHandler"/> that applies the access token to all outgoing requests.</returns>
- public HttpMessageHandler CreateMessageHandler(AccessToken accessToken) {
- Requires.NotNullOrEmpty(accessToken.Token, "accessToken");
-
- return this.Consumer.CreateMessageHandler(accessToken);
- }
-
- /// <summary>
- /// The process user authorization.
- /// </summary>
- /// <param name="context">The HTTP context.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// The response message.
- /// </returns>
- public Task<AccessTokenResponse> ProcessUserAuthorizationAsync(HttpContextBase context = null, CancellationToken cancellationToken = default(CancellationToken)) {
- if (context == null) {
- context = new HttpContextWrapper(HttpContext.Current);
- }
-
- return this.webConsumer.ProcessUserAuthorizationAsync(context.Request.Url, cancellationToken: cancellationToken);
- }
-
- /// <summary>
- /// The request authentication.
- /// </summary>
- /// <param name="callback">The callback.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// The response message.
- /// </returns>
- public Task<Uri> RequestAuthenticationAsync(Uri callback, CancellationToken cancellationToken = default(CancellationToken)) {
- return this.webConsumer.RequestUserAuthorizationAsync(callback, cancellationToken: cancellationToken);
- }
-
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs
deleted file mode 100644
index 719e520..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="IOAuthWebWorker.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.Net;
- using System.Net.Http;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Web;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OAuth;
- using DotNetOpenAuth.OAuth.Messages;
-
- /// <summary>
- /// The interface implemented by all OAuth web authentication modules in this assembly.
- /// </summary>
- public interface IOAuthWebWorker {
- /// <summary>
- /// Creates an HTTP message handler that authorizes outgoing web requests.
- /// </summary>
- /// <param name="accessToken">The access token.</param>
- /// <returns>An <see cref="HttpMessageHandler"/> that applies the access token to all outgoing requests.</returns>
- HttpMessageHandler CreateMessageHandler(AccessToken accessToken);
-
- /// <summary>
- /// The process user authorization.
- /// </summary>
- /// <param name="context">The HTTP context.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// The access token, if obtained; otherwise <c>null</c>.
- /// </returns>
- Task<AccessTokenResponse> ProcessUserAuthorizationAsync(HttpContextBase context = null, CancellationToken cancellationToken = default(CancellationToken));
-
- /// <summary>
- /// The request authentication.
- /// </summary>
- /// <param name="callback">The callback.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>The URL to redirect the user agent to.</returns>
- Task<Uri> RequestAuthenticationAsync(Uri callback, CancellationToken cancellationToken = default(CancellationToken));
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs
deleted file mode 100644
index c758c9c..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="LinkedInClient.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Diagnostics.CodeAnalysis;
- using System.IO;
- using System.Net;
- using System.Net.Http;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Xml.Linq;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OAuth;
- using DotNetOpenAuth.OAuth.ChannelElements;
- using DotNetOpenAuth.OAuth.Messages;
-
- /// <summary>
- /// Represents LinkedIn authentication client.
- /// </summary>
- public sealed class LinkedInClient : OAuthClient {
- #region Constants and Fields
-
- /// <summary>
- /// Describes the OAuth service provider endpoints for LinkedIn.
- /// </summary>
- public static readonly ServiceProviderDescription LinkedInServiceDescription = new ServiceProviderDescription(
- "https://api.linkedin.com/uas/oauth/requestToken",
- "https://www.linkedin.com/uas/oauth/authenticate",
- "https://api.linkedin.com/uas/oauth/accessToken");
-
- #endregion
-
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="LinkedInClient"/> class.
- /// </summary>
- /// <param name="consumerKey">The consumer key.</param>
- /// <param name="consumerSecret">The consumer secret.</param>
- public LinkedInClient(string consumerKey, string consumerSecret)
- : base("linkedIn", LinkedInServiceDescription, consumerKey, consumerSecret) {
- }
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// Check if authentication succeeded after user is redirected back from the service provider.
- /// </summary>
- /// <param name="response">The response token returned from service provider</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// Authentication result.
- /// </returns>
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
- Justification = "We don't care if the request fails.")]
- protected override async Task<AuthenticationResult> VerifyAuthenticationCoreAsync(AccessTokenResponse response, CancellationToken cancellationToken = default(CancellationToken)) {
- // See here for Field Selectors API http://developer.linkedin.com/docs/DOC-1014
- const string ProfileRequestUrl = "https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,industry,summary)";
-
- var accessToken = response.AccessToken;
- var authorizingHandler = this.WebWorker.CreateMessageHandler(accessToken);
- try {
- using (var httpClient = new HttpClient(authorizingHandler)) {
- using (HttpResponseMessage profileResponse = await httpClient.GetAsync(ProfileRequestUrl, cancellationToken)) {
- using (Stream responseStream = await profileResponse.Content.ReadAsStreamAsync()) {
- XDocument document = LoadXDocumentFromStream(responseStream);
- string userId = document.Root.Element("id").Value;
-
- string firstName = document.Root.Element("first-name").Value;
- string lastName = document.Root.Element("last-name").Value;
- string userName = firstName + " " + lastName;
-
- var extraData = new NameValueCollection();
- extraData.Add("accesstoken", accessToken.Token);
- extraData.Add("accesstokensecret", accessToken.Secret);
- extraData.Add("name", userName);
- extraData.AddDataIfNotEmpty(document, "headline");
- extraData.AddDataIfNotEmpty(document, "summary");
- extraData.AddDataIfNotEmpty(document, "industry");
-
- return new AuthenticationResult(
- isSuccessful: true,
- provider: this.ProviderName,
- providerUserId: userId,
- userName: userName,
- extraData: extraData);
- }
- }
- }
- } catch (Exception exception) {
- return new AuthenticationResult(exception);
- }
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs
deleted file mode 100644
index 6189446..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs
+++ /dev/null
@@ -1,162 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OAuthClient.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Diagnostics.CodeAnalysis;
- using System.IO;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Web;
- using System.Xml;
- using System.Xml.Linq;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OAuth;
- using DotNetOpenAuth.OAuth.ChannelElements;
- using DotNetOpenAuth.OAuth.Messages;
- using Validation;
-
- /// <summary>
- /// Represents base class for OAuth 1.0 clients
- /// </summary>
- public abstract class OAuthClient : IAuthenticationClient {
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="OAuthClient" /> class.
- /// </summary>
- /// <param name="providerName">Name of the provider.</param>
- /// <param name="serviceDescription">The service Description.</param>
- /// <param name="consumerKey">The consumer key.</param>
- /// <param name="consumerSecret">The consumer secret.</param>
- protected OAuthClient(
- string providerName, ServiceProviderDescription serviceDescription, string consumerKey, string consumerSecret)
- : this(providerName, new DotNetOpenAuthWebConsumer(serviceDescription, consumerKey, consumerSecret)) {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="OAuthClient"/> class.
- /// </summary>
- /// <param name="providerName">
- /// The provider name.
- /// </param>
- /// <param name="webWorker">
- /// The web worker.
- /// </param>
- protected OAuthClient(string providerName, IOAuthWebWorker webWorker) {
- Requires.NotNull(providerName, "providerName");
- Requires.NotNull(webWorker, "webWorker");
-
- this.ProviderName = providerName;
- this.WebWorker = webWorker;
- }
-
- #endregion
-
- #region Public Properties
-
- /// <summary>
- /// Gets the name of the provider which provides authentication service.
- /// </summary>
- public string ProviderName { get; private set; }
-
- #endregion
-
- #region Properties
-
- /// <summary>
- /// Gets the OAuthWebConsumer instance which handles constructing requests to the OAuth providers.
- /// </summary>
- protected IOAuthWebWorker WebWorker { get; private set; }
-
- #endregion
-
- #region Public Methods and Operators
-
- /// <summary>
- /// Attempts to authenticate users by forwarding them to an external website, and upon succcess or failure, redirect users back to the specified url.
- /// </summary>
- /// <param name="context">The context.</param>
- /// <param name="returnUrl">The return url after users have completed authenticating against external website.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// A task that completes with the asynchronous operation.
- /// </returns>
- public virtual Task RequestAuthenticationAsync(HttpContextBase context, Uri returnUrl, CancellationToken cancellationToken = default(CancellationToken)) {
- Requires.NotNull(returnUrl, "returnUrl");
- Requires.NotNull(context, "context");
-
- Uri callback = returnUrl.StripQueryArgumentsWithPrefix("oauth_");
- return this.WebWorker.RequestAuthenticationAsync(callback, cancellationToken);
- }
-
- /// <summary>
- /// Check if authentication succeeded after user is redirected back from the service provider.
- /// </summary>
- /// <param name="context">The context.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// An instance of <see cref="AuthenticationResult" /> containing authentication result.
- /// </returns>
- public virtual async Task<AuthenticationResult> VerifyAuthenticationAsync(HttpContextBase context, CancellationToken cancellationToken = default(CancellationToken)) {
- AccessTokenResponse response = await this.WebWorker.ProcessUserAuthorizationAsync(context, cancellationToken);
- if (response == null) {
- return AuthenticationResult.Failed;
- }
-
- AuthenticationResult result = await this.VerifyAuthenticationCoreAsync(response, cancellationToken);
- 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 = new NameValueCollection(result.ExtraData);
- wrapExtraData["accesstoken"] = response.AccessToken.Token;
- wrapExtraData["accesstokensecret"] = response.AccessToken.Secret;
-
- AuthenticationResult wrapResult = new AuthenticationResult(
- result.IsSuccessful,
- result.Provider,
- result.ProviderUserId,
- result.UserName,
- wrapExtraData);
-
- result = wrapResult;
- }
-
- return result;
- }
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// Helper method to load an XDocument from an input stream.
- /// </summary>
- /// <param name="stream">The input stream from which to load the document.</param>
- /// <returns>The XML document.</returns>
- internal static XDocument LoadXDocumentFromStream(Stream stream) {
- const int MaxChars = 0x10000; // 64k
-
- var settings = MessagingUtilities.CreateUntrustedXmlReaderSettings();
- settings.MaxCharactersInDocument = MaxChars;
- return XDocument.Load(XmlReader.Create(stream, settings));
- }
-
- /// <summary>
- /// Check if authentication succeeded after user is redirected back from the service provider.
- /// </summary>
- /// <param name="response">
- /// The access token returned from service provider
- /// </param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// Authentication result
- /// </returns>
- protected abstract Task<AuthenticationResult> VerifyAuthenticationCoreAsync(AccessTokenResponse response, CancellationToken cancellationToken);
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs
deleted file mode 100644
index 7e80cad..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="TwitterClient.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Diagnostics.CodeAnalysis;
- using System.IO;
- using System.Net;
- using System.Net.Http;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Xml.Linq;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OAuth;
- using DotNetOpenAuth.OAuth.ChannelElements;
- using DotNetOpenAuth.OAuth.Messages;
-
- /// <summary>
- /// Represents a Twitter client
- /// </summary>
- public class TwitterClient : OAuthClient {
- #region Constants and Fields
-
- /// <summary>
- /// The description of Twitter's OAuth protocol URIs for use with their "Sign in with Twitter" feature.
- /// </summary>
- public static readonly ServiceProviderDescription TwitterServiceDescription =
- new ServiceProviderDescription(
- "https://api.twitter.com/oauth/request_token",
- "https://api.twitter.com/oauth/authenticate",
- "https://api.twitter.com/oauth/access_token");
-
- #endregion
-
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TwitterClient"/> class.
- /// </summary>
- /// <param name="consumerKey">The consumer key.</param>
- /// <param name="consumerSecret">The consumer secret.</param>
- public TwitterClient(string consumerKey, string consumerSecret)
- : base("twitter", TwitterServiceDescription, consumerKey, consumerSecret) {
- }
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// Check if authentication succeeded after user is redirected back from the service provider.
- /// </summary>
- /// <param name="response">The response token returned from service provider</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// Authentication result
- /// </returns>
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
- Justification = "We don't care if the request for additional data fails.")]
- protected override async Task<AuthenticationResult> VerifyAuthenticationCoreAsync(AccessTokenResponse response, CancellationToken cancellationToken) {
- string userId = response.ExtraData["user_id"];
- string userName = response.ExtraData["screen_name"];
-
- var profileRequestUrl = new Uri("https://api.twitter.com/1/users/show.xml?user_id="
- + MessagingUtilities.EscapeUriDataStringRfc3986(userId));
- var authorizingHandler = this.WebWorker.CreateMessageHandler(response.AccessToken);
-
- var extraData = new NameValueCollection();
- extraData.Add("accesstoken", response.AccessToken.Token);
- extraData.Add("accesstokensecret", response.AccessToken.Secret);
- try {
- using (var httpClient = new HttpClient(authorizingHandler)) {
- using (HttpResponseMessage profileResponse = await httpClient.GetAsync(profileRequestUrl, cancellationToken)) {
- using (Stream responseStream = await profileResponse.Content.ReadAsStreamAsync()) {
- XDocument document = LoadXDocumentFromStream(responseStream);
- extraData.AddDataIfNotEmpty(document, "name");
- extraData.AddDataIfNotEmpty(document, "location");
- extraData.AddDataIfNotEmpty(document, "description");
- extraData.AddDataIfNotEmpty(document, "url");
- }
- }
- }
- }
- catch (Exception) {
- // At this point, the authentication is already successful.
- // Here we are just trying to get additional data if we can.
- // If it fails, no problem.
- }
-
- return new AuthenticationResult(
- isSuccessful: true, provider: this.ProviderName, providerUserId: userId, userName: userName, extraData: extraData);
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADClaims.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADClaims.cs
deleted file mode 100644
index deb396f..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADClaims.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="AzureADClaims.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.ComponentModel;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Contains clains of a AzureAD token.
- /// </summary>
- /// <remarks>
- /// Technically, this class doesn't need to be public, but because we want to make it serializable in medium trust, it has to be public.
- /// </remarks>
- [DataContract]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "AzureAD", Justification = "Brand name")]
- public class AzureADClaims {
- #region Public Properties
-
- /// <summary>
- /// Gets or sets the audience.
- /// </summary>
- /// <value> The audience token is valid for. </value>
- [DataMember(Name = "aud")]
- public string Aud { get; set; }
-
- /// <summary>
- /// Gets or sets the issuer.
- /// </summary>
- /// <value> The issuer. </value>
- [DataMember(Name = "iss")]
- public string Iss { get; set; }
-
- /// <summary>
- /// Gets or sets the early expiry time.
- /// </summary>
- /// <value> The early expiry time. </value>
- [DataMember(Name = "nbf")]
- public string Nbf { get; set; }
-
- /// <summary>
- /// Gets or sets the expiry time.
- /// </summary>
- /// <value> The expiry time. </value>
- [DataMember(Name = "exp")]
- public string Exp { get; set; }
-
- /// <summary>
- /// Gets or sets the id of the user.
- /// </summary>
- /// <value> The id of the user. </value>
- [DataMember(Name = "oid")]
- public string Oid { get; set; }
-
- /// <summary>
- /// Gets or sets the id of the tenant.
- /// </summary>
- /// <value> The tenant . </value>
- [DataMember(Name = "tid")]
- public string Tid { get; set; }
-
- /// <summary>
- /// Gets or sets the appid of application.
- /// </summary>
- /// <value> The id of the application. </value>
- [DataMember(Name = "appid")]
- public string Appid { get; set; }
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADClient.cs
deleted file mode 100644
index c3d6413..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADClient.cs
+++ /dev/null
@@ -1,460 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="AzureADClient.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Diagnostics.CodeAnalysis;
- using System.IdentityModel.Tokens;
- using System.IO;
- using System.Net;
- using System.Security.Cryptography;
- using System.Security.Cryptography.X509Certificates;
- using System.Text;
- using System.Web;
- using System.Web.Script.Serialization;
- using System.Xml;
- using DotNetOpenAuth.Messaging;
-
- using Validation;
-
- /// <summary>
- /// The AzureAD client.
- /// </summary>
- [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "AzureAD", Justification = "Brand name")]
- public sealed class AzureADClient : OAuth2Client {
- #region Constants and Fields
-
- /// <summary>
- /// The authorization endpoint.
- /// </summary>
- private const string AuthorizationEndpoint = "https://login.windows.net/common/oauth2/authorize";
-
- /// <summary>
- /// The token endpoint.
- /// </summary>
- private const string TokenEndpoint = "https://login.windows.net/common/oauth2/token";
-
- /// <summary>
- /// The name of the graph resource.
- /// </summary>
- private const string GraphResource = "https://graph.windows.net";
-
- /// <summary>
- /// The URL to get the token decoding certificate from.
- /// </summary>
- private const string MetaDataEndpoint = "https://login.windows.net/evosts.onmicrosoft.com/FederationMetadata/2007-06/FederationMetadata.xml";
-
- /// <summary>
- /// The URL for AzureAD graph.
- /// </summary>
- private const string GraphEndpoint = "https://graph.windows.net/";
-
- /// <summary>
- /// The id of the STS.
- /// </summary>
- private const string STSName = "https://sts.windows.net";
-
- /// <summary>
- /// The app id.
- /// </summary>
- private readonly string appId;
-
- /// <summary>
- /// The app secret.
- /// </summary>
- private readonly string appSecret;
-
- /// <summary>
- /// The resource to target.
- /// </summary>
- private readonly string resource;
-
- /// <summary>
- /// Encoding cert.
- /// </summary>
- private static X509Certificate2[] encodingcert;
-
- /// <summary>
- /// Hash algo used by the X509Cert.
- /// </summary>
- private static HashAlgorithm hash;
-
- /// <summary>
- /// The tenantid claim for the authcode.
- /// </summary>
- private string tenantid;
-
- /// <summary>
- /// The userid claim for the authcode.
- /// </summary>
- private string userid;
- #endregion
-
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AzureADClient"/> class.
- /// </summary>
- /// <param name="appId">
- /// The app id.
- /// </param>
- /// <param name="appSecret">
- /// The app secret.
- /// </param>
- public AzureADClient(string appId, string appSecret)
- : this(appId, appSecret, GraphResource) {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AzureADClient"/> class.
- /// </summary>
- /// <param name="appId">
- /// The app id.
- /// </param>
- /// <param name="appSecret">
- /// The app secret.
- /// </param>
- /// <param name="resource">
- /// The resource of oauth request.
- /// </param>
- public AzureADClient(string appId, string appSecret, string resource)
- : base("azuread") {
- Requires.NotNullOrEmpty(appId, "appId");
- Requires.NotNullOrEmpty(appSecret, "appSecret");
- Requires.NotNullOrEmpty(resource, "resource");
- this.appId = appId;
- this.appSecret = appSecret;
- this.resource = resource;
- }
- #endregion
-
- #region Methods
-
- /// <summary>
- /// The get service login url.
- /// </summary>
- /// <param name="returnUrl">
- /// The return url.
- /// </param>
- /// <returns>An absolute URI.</returns>
- protected override Uri GetServiceLoginUrl(Uri returnUrl) {
- var builder = new UriBuilder(AuthorizationEndpoint);
- builder.AppendQueryArgs(
- new Dictionary<string, string> {
- { "client_id", this.appId },
- { "redirect_uri", returnUrl.AbsoluteUri },
- { "response_type", "code" },
- { "resource", this.resource },
- });
- return builder.Uri;
- }
-
- /// <summary>
- /// The get user data.
- /// </summary>
- /// <param name="accessToken">
- /// The access token.
- /// </param>
- /// <returns>A dictionary of profile data.</returns>
- protected override NameValueCollection GetUserData(string accessToken) {
- var userData = new NameValueCollection();
- try {
- AzureADGraph graphData;
- WebRequest request =
- WebRequest.Create(
- GraphEndpoint + this.tenantid + "/users/" + this.userid + "?api-version=2013-04-05");
- request.Headers = new WebHeaderCollection();
- request.Headers.Add("authorization", accessToken);
- using (var response = request.GetResponse()) {
- using (var responseStream = response.GetResponseStream()) {
- graphData = JsonHelper.Deserialize<AzureADGraph>(responseStream);
- }
- }
-
- // this dictionary must contains
- userData.AddItemIfNotEmpty("id", graphData.ObjectId);
- userData.AddItemIfNotEmpty("username", graphData.UserPrincipalName);
- userData.AddItemIfNotEmpty("name", graphData.DisplayName);
-
- return userData;
- } catch (Exception e) {
- System.Diagnostics.Debug.WriteLine(e.ToStringDescriptive());
- return userData;
- }
- }
-
- /// <summary>
- /// Obtains an access token given an authorization code and callback URL.
- /// </summary>
- /// <param name="returnUrl">
- /// The return url.
- /// </param>
- /// <param name="authorizationCode">
- /// The authorization code.
- /// </param>
- /// <returns>
- /// The access token.
- /// </returns>
- protected override string QueryAccessToken(Uri returnUrl, string authorizationCode) {
- try {
- 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" },
- { "api_version", "1.0" },
- });
-
- WebRequest tokenRequest = WebRequest.Create(TokenEndpoint);
- tokenRequest.ContentType = "application/x-www-form-urlencoded";
- tokenRequest.ContentLength = entity.Length;
- tokenRequest.Method = "POST";
-
- using (Stream requestStream = tokenRequest.GetRequestStream()) {
- var writer = new StreamWriter(requestStream);
- writer.Write(entity);
- writer.Flush();
- }
-
- HttpWebResponse tokenResponse = (HttpWebResponse)tokenRequest.GetResponse();
- if (tokenResponse.StatusCode == HttpStatusCode.OK) {
- using (Stream responseStream = tokenResponse.GetResponseStream()) {
- var tokenData = JsonHelper.Deserialize<OAuth2AccessTokenData>(responseStream);
- if (tokenData != null) {
- AzureADClaims claimsAD;
- claimsAD = this.ParseAccessToken(tokenData.AccessToken, true);
- if (claimsAD != null) {
- this.tenantid = claimsAD.Tid;
- this.userid = claimsAD.Oid;
- return tokenData.AccessToken;
- }
- return string.Empty;
- }
- }
- }
-
- return null;
- } catch (Exception e) {
- System.Diagnostics.Debug.WriteLine(e.ToStringDescriptive());
- return null;
- }
- }
-
- /// <summary>
- /// Base64 decode function except that it switches -_ to +/ before base64 decode
- /// </summary>
- /// <param name="str">
- /// The string to be base64urldecoded.
- /// </param>
- /// <returns>
- /// Decoded string as string using UTF8 encoding.
- /// </returns>
- private static string Base64URLdecode(string str) {
- System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
- return encoder.GetString(Base64URLdecodebyte(str));
- }
-
- /// <summary>
- /// Base64 decode function except that it switches -_ to +/ before base64 decode
- /// </summary>
- /// <param name="str">
- /// The string to be base64urldecoded.
- /// </param>
- /// <returns>
- /// Decoded string as bytes.
- /// </returns>
- private static byte[] Base64URLdecodebyte(string str) {
- // First replace chars and then pad per spec
- str = str.Replace('-', '+').Replace('_', '/');
- str = str.PadRight(str.Length + ((4 - (str.Length % 4)) % 4), '=');
- return Convert.FromBase64String(str);
- }
-
- /// <summary>
- /// Validate whether the unsigned value is same as signed value
- /// </summary>
- /// <param name="uval">
- /// The raw input of the string signed using the key
- /// </param>
- /// <param name="sval">
- /// The signature of the string
- /// </param>
- /// <param name="certthumb">
- /// The thumbprint of cert used to encrypt token
- /// </param>
- /// <returns>
- /// True if same, false otherwise.
- /// </returns>
- private static bool ValidateSig(byte[] uval, byte[] sval, byte[] certthumb) {
- try {
- bool ret = false;
-
- X509Certificate2[] certx509 = GetEncodingCert();
- string certthumbhex = string.Empty;
-
- // Get the hexadecimail representation of the certthumbprint
- for (int i = 0; i < certthumb.Length; i++) {
- certthumbhex += certthumb[i].ToString("X2");
- }
-
- for (int c = 0; c < certx509.Length; c++) {
- // Skip any cert that does not have the same thumbprint as token
- if (certx509[c].Thumbprint.ToLower() != certthumbhex.ToLower()) {
- continue;
- }
- X509SecurityToken tok = new X509SecurityToken(certx509[c]);
- if (tok == null) {
- return false;
- }
- for (int i = 0; i < tok.SecurityKeys.Count; i++) {
- X509AsymmetricSecurityKey key = tok.SecurityKeys[i] as X509AsymmetricSecurityKey;
- RSACryptoServiceProvider rsa = key.GetAsymmetricAlgorithm(SecurityAlgorithms.RsaSha256Signature, false) as RSACryptoServiceProvider;
-
- if (rsa == null) {
- continue;
- }
- ret = rsa.VerifyData(uval, hash, sval);
- if (ret == true) {
- return ret;
- }
- }
- }
- return ret;
- } catch (CryptographicException e) {
- Console.WriteLine(e.ToStringDescriptive());
- return false;
- }
- }
-
- /// <summary>
- /// Returns the certificate with which the token is encoded.
- /// </summary>
- /// <returns>
- /// The encoding certificate.
- /// </returns>
- private static X509Certificate2[] GetEncodingCert() {
- if (encodingcert != null) {
- return encodingcert;
- }
- try {
- // Lock for exclusive access
- lock (typeof(AzureADClient)) {
- XmlDocument doc = new XmlDocument();
-
- WebRequest request =
- WebRequest.Create(MetaDataEndpoint);
- using (WebResponse response = request.GetResponse()) {
- using (Stream responseStream = response.GetResponseStream()) {
- doc.Load(responseStream);
- XmlNodeList list = doc.GetElementsByTagName("X509Certificate");
- encodingcert = new X509Certificate2[list.Count];
- for (int i = 0; i < list.Count; i++) {
- byte[] todecode_byte = Convert.FromBase64String(list[i].InnerText);
- encodingcert[i] = new X509Certificate2(todecode_byte);
- }
- if (hash == null) {
- hash = SHA256.Create();
- }
- }
- }
- }
- return encodingcert;
- } catch (Exception e) {
- System.Diagnostics.Debug.WriteLine(e.ToStringDescriptive());
- return null;
- }
- }
-
- /// <summary>
- /// Parses the access token into an AzureAD token.
- /// </summary>
- /// <param name="token">
- /// The token as a string.
- /// </param>
- /// <param name="validate">
- /// Whether to validate against time\audience.
- /// </param>
- /// <returns>
- /// The claims as an object and null in case of failure.
- /// </returns>
- private AzureADClaims ParseAccessToken(string token, bool validate) {
- try {
- // This is the encoded JWT token split into the 3 parts
- string[] strparts = token.Split('.');
-
- // Decparts has the header and claims section decoded from JWT
- string jwtHeader, jwtClaims;
- string jwtb64Header, jwtb64Claims, jwtb64Sig;
- byte[] jwtSig;
- if (strparts.Length != 3) {
- return null;
- }
- jwtb64Header = strparts[0];
- jwtb64Claims = strparts[1];
- jwtb64Sig = strparts[2];
- jwtHeader = Base64URLdecode(jwtb64Header);
- jwtClaims = Base64URLdecode(jwtb64Claims);
- jwtSig = Base64URLdecodebyte(jwtb64Sig);
-
- JavaScriptSerializer s1 = new JavaScriptSerializer();
-
- AzureADClaims claimsAD = s1.Deserialize<AzureADClaims>(jwtClaims);
- AzureADHeader headerAD = s1.Deserialize<AzureADHeader>(jwtHeader);
-
- if (validate) {
- // Check to see if the token is valid
- // Check if its JWT and RSA encoded
- if (headerAD.Typ.ToUpper() != "JWT") {
- return null;
- }
-
- // Check if its JWT and RSA encoded
- if (headerAD.Alg.ToUpper() != "RS256") {
- return null;
- }
- if (string.IsNullOrEmpty(headerAD.X5t)) {
- return null;
- }
-
- // Check audience to be graph
- if (claimsAD.Aud.ToLower().ToLower() != GraphResource.ToLower()) {
- return null;
- }
-
- // Check issuer to be sts
- if (claimsAD.Iss.ToLower().IndexOf(STSName.ToLower()) != 0) {
- return null;
- }
-
- // Check time validity
- TimeSpan span = DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc));
- double secsnow = span.TotalSeconds;
- double nbfsecs = Convert.ToDouble(claimsAD.Nbf);
- double expsecs = Convert.ToDouble(claimsAD.Exp);
- if ((nbfsecs - 100 > secsnow) || (secsnow > expsecs + 100)) {
- return null;
- }
-
- // Validate the signature of the token
- string tokUnsigned = jwtb64Header + "." + jwtb64Claims;
- if (!ValidateSig(Encoding.UTF8.GetBytes(tokUnsigned), jwtSig, Base64URLdecodebyte(headerAD.X5t))) {
- return null;
- }
- }
- return claimsAD;
- } catch (Exception e) {
- System.Diagnostics.Debug.WriteLine(e.ToStringDescriptive());
- return null;
- }
- }
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADGraph.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADGraph.cs
deleted file mode 100644
index 8269419..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADGraph.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="AzureADGraph.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.ComponentModel;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Contains data of a AzureAD user.
- /// </summary>
- /// <remarks>
- /// Technically, this class doesn't need to be public, but because we want to make it serializable in medium trust, it has to be public.
- /// </remarks>
- [DataContract]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "AzureAD", Justification = "Brand name")]
- public class AzureADGraph {
- #region Public Properties
-
- /// <summary>
- /// Gets or sets the firstname.
- /// </summary>
- /// <value> The first name. </value>
- [DataMember(Name = "givenName")]
- public string GivenName { get; set; }
-
- /// <summary>
- /// Gets or sets the lastname.
- /// </summary>
- /// <value> The last name. </value>
- [DataMember(Name = "surname")]
- public string Surname { get; set; }
-
- /// <summary>
- /// Gets or sets the email.
- /// </summary>
- /// <value> The email. </value>
- [DataMember(Name = "userPrincipalName")]
- public string UserPrincipalName { get; set; }
-
- /// <summary>
- /// Gets or sets the fullname.
- /// </summary>
- /// <value> The fullname. </value>
- [DataMember(Name = "displayName")]
- public string DisplayName { get; set; }
-
- /// <summary>
- /// Gets or sets the id.
- /// </summary>
- /// <value> The id. </value>
- [DataMember(Name = "objectId")]
- public string ObjectId { get; set; }
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADHeader.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADHeader.cs
deleted file mode 100644
index 042eccb..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/AzureADHeader.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="AzureADHeader.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.ComponentModel;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Contains header of AzureAD JWT token.
- /// </summary>
- /// <remarks>
- /// Technically, this class doesn't need to be public, but because we want to make it serializable in medium trust, it has to be public.
- /// </remarks>
- [DataContract]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "AzureAD", Justification = "Brand name")]
-
- public class AzureADHeader {
- #region Public Properties
-
- /// <summary>
- /// Gets or sets the type of token. Will always be JWT
- /// </summary>
- /// <value> The type of token. </value>
- [DataMember(Name = "typ")]
- public string Typ { get; set; }
-
- /// <summary>
- /// Gets or sets the algo of the header.
- /// </summary>
- /// <value> The algo of encoding. </value>
- [DataMember(Name = "alg")]
- public string Alg { get; set; }
-
- /// <summary>
- /// Gets or sets the thumbprint of the header.
- /// </summary>
- /// <value> The thumbprint of the cert used to encode. </value>
- [DataMember(Name = "x5t")]
- public string X5t { get; set; }
-
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs
deleted file mode 100644
index 611f322..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs
+++ /dev/null
@@ -1,201 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="FacebookClient.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Diagnostics.CodeAnalysis;
- using System.Net;
- using System.Web;
- using DotNetOpenAuth.Messaging;
- using Validation;
-
- /// <summary>
- /// The facebook client.
- /// </summary>
- [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Facebook", Justification = "Brand name")]
- public sealed class FacebookClient : OAuth2Client {
- #region Constants and Fields
-
- /// <summary>
- /// The authorization endpoint.
- /// </summary>
- private const string AuthorizationEndpoint = "https://www.facebook.com/dialog/oauth";
-
- /// <summary>
- /// The token endpoint.
- /// </summary>
- private const string TokenEndpoint = "https://graph.facebook.com/oauth/access_token";
-
- /// <summary>
- /// The _app id.
- /// </summary>
- private readonly string appId;
-
- /// <summary>
- /// The _app secret.
- /// </summary>
- private readonly string appSecret;
-
- /// <summary>
- /// The scope.
- /// </summary>
- private readonly string[] scope;
-
- #endregion
-
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="FacebookClient"/> class
- /// with "email" as the scope.
- /// </summary>
- /// <param name="appId">
- /// The app id.
- /// </param>
- /// <param name="appSecret">
- /// The app secret.
- /// </param>
- public FacebookClient(string appId, string appSecret)
- : this(appId, appSecret, "email") {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="FacebookClient"/> class.
- /// </summary>
- /// <param name="appId">
- /// The app id.
- /// </param>
- /// <param name="appSecret">
- /// The app secret.
- /// </param>
- /// <param name="scope">
- /// The scope of authorization to request when authenticating with Facebook. The default is "email".
- /// </param>
- public FacebookClient(string appId, string appSecret, params string[] scope)
- : base("facebook") {
- Requires.NotNullOrEmpty(appId, "appId");
- Requires.NotNullOrEmpty(appSecret, "appSecret");
- Requires.NotNullOrEmpty(scope, "scope");
-
- this.appId = appId;
- this.appSecret = appSecret;
- this.scope = scope;
- }
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// The get service login url.
- /// </summary>
- /// <param name="returnUrl">
- /// The return url.
- /// </param>
- /// <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 },
- { "scope", string.Join(" ", this.scope) },
- });
- return builder.Uri;
- }
-
- /// <summary>
- /// The get user data.
- /// </summary>
- /// <param name="accessToken">
- /// The access token.
- /// </param>
- /// <returns>A dictionary of profile data.</returns>
- protected override NameValueCollection GetUserData(string accessToken) {
- FacebookGraphData graphData;
- var request =
- WebRequest.Create(
- "https://graph.facebook.com/me?access_token=" + MessagingUtilities.EscapeUriDataStringRfc3986(accessToken));
- using (var response = request.GetResponse()) {
- using (var responseStream = response.GetResponseStream()) {
- graphData = JsonHelper.Deserialize<FacebookGraphData>(responseStream);
- }
- }
-
- // this dictionary must contains
- var userData = new NameValueCollection();
- userData.AddItemIfNotEmpty("id", graphData.Id);
- userData.AddItemIfNotEmpty("username", graphData.Email);
- userData.AddItemIfNotEmpty("name", graphData.Name);
- userData.AddItemIfNotEmpty("link", graphData.Link == null ? null : graphData.Link.AbsoluteUri);
- userData.AddItemIfNotEmpty("gender", graphData.Gender);
- userData.AddItemIfNotEmpty("birthday", graphData.Birthday);
- return userData;
- }
-
- /// <summary>
- /// Obtains an access token given an authorization code and callback URL.
- /// </summary>
- /// <param name="returnUrl">
- /// The return url.
- /// </param>
- /// <param name="authorizationCode">
- /// The authorization code.
- /// </param>
- /// <returns>
- /// 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", NormalizeHexEncoding(returnUrl.AbsoluteUri) },
- { "client_secret", this.appSecret },
- { "code", authorizationCode },
- { "scope", "email" },
- });
-
- using (WebClient client = new WebClient()) {
- string data = client.DownloadString(builder.Uri);
- if (string.IsNullOrEmpty(data)) {
- return null;
- }
-
- var parsedQueryString = HttpUtility.ParseQueryString(data);
- return parsedQueryString["access_token"];
- }
- }
-
- /// <summary>
- /// Converts any % encoded values in the URL to uppercase.
- /// </summary>
- /// <param name="url">The URL string to normalize</param>
- /// <returns>The normalized url</returns>
- /// <example>NormalizeHexEncoding("Login.aspx?ReturnUrl=%2fAccount%2fManage.aspx") returns "Login.aspx?ReturnUrl=%2FAccount%2FManage.aspx"</example>
- /// <remarks>
- /// There is an issue in Facebook whereby it will rejects the redirect_uri value if
- /// the url contains lowercase % encoded values.
- /// </remarks>
- private static string NormalizeHexEncoding(string url) {
- var chars = url.ToCharArray();
- for (int i = 0; i < chars.Length - 2; i++) {
- if (chars[i] == '%') {
- chars[i + 1] = char.ToUpperInvariant(chars[i + 1]);
- chars[i + 2] = char.ToUpperInvariant(chars[i + 2]);
- i += 2;
- }
- }
- return new string(chars);
- }
-
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookGraphData.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookGraphData.cs
deleted file mode 100644
index 9ad3eff..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookGraphData.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="FacebookGraphData.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.ComponentModel;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Contains data of a Facebook user.
- /// </summary>
- /// <remarks>
- /// Technically, this class doesn't need to be public, but because we want to make it serializable in medium trust, it has to be public.
- /// </remarks>
- [DataContract]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Facebook", Justification = "Brand name")]
- public class FacebookGraphData {
- #region Public Properties
-
- /// <summary>
- /// Gets or sets the birthday.
- /// </summary>
- /// <value> The birthday. </value>
- [DataMember(Name = "birthday")]
- public string Birthday { get; set; }
-
- /// <summary>
- /// Gets or sets the email.
- /// </summary>
- /// <value> The email. </value>
- [DataMember(Name = "email")]
- public string Email { get; set; }
-
- /// <summary>
- /// Gets or sets the gender.
- /// </summary>
- /// <value> The gender. </value>
- [DataMember(Name = "gender")]
- public string Gender { get; set; }
-
- /// <summary>
- /// Gets or sets the id.
- /// </summary>
- /// <value> The id. </value>
- [DataMember(Name = "id")]
- public string Id { get; set; }
-
- /// <summary>
- /// Gets or sets the link.
- /// </summary>
- /// <value> The link. </value>
- [DataMember(Name = "link")]
- public Uri Link { get; set; }
-
- /// <summary>
- /// Gets or sets the name.
- /// </summary>
- /// <value> The name. </value>
- [DataMember(Name = "name")]
- public string Name { get; set; }
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/JsonHelper.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/JsonHelper.cs
deleted file mode 100644
index 918a8a9..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/JsonHelper.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="JsonHelper.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.IO;
- using System.Runtime.Serialization.Json;
- using Validation;
-
- /// <summary>
- /// The json helper.
- /// </summary>
- internal static class JsonHelper {
- #region Public Methods and Operators
-
- /// <summary>
- /// The deserialize.
- /// </summary>
- /// <param name="stream">
- /// The stream.
- /// </param>
- /// <typeparam name="T">The type of the value to deserialize.</typeparam>
- /// <returns>
- /// The deserialized value.
- /// </returns>
- public static T Deserialize<T>(Stream stream) where T : class {
- Requires.NotNull(stream, "stream");
-
- var serializer = new DataContractJsonSerializer(typeof(T));
- return (T)serializer.ReadObject(stream);
- }
-
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs
deleted file mode 100644
index 5074c0b..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs
+++ /dev/null
@@ -1,200 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="MicrosoftClient.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.IO;
- using System.Net;
- using DotNetOpenAuth.Messaging;
- using Validation;
-
- /// <summary>
- /// The Microsoft account client.
- /// </summary>
- public class MicrosoftClient : OAuth2Client {
- #region Constants and Fields
-
- /// <summary>
- /// The authorization endpoint.
- /// </summary>
- private const string AuthorizationEndpoint = "https://login.live.com/oauth20_authorize.srf";
-
- /// <summary>
- /// The token endpoint.
- /// </summary>
- private const string TokenEndpoint = "https://login.live.com/oauth20_token.srf";
-
- /// <summary>
- /// The _app id.
- /// </summary>
- private readonly string appId;
-
- /// <summary>
- /// The _app secret.
- /// </summary>
- private readonly string appSecret;
-
- /// <summary>
- /// The requested scopes.
- /// </summary>
- private readonly string[] requestedScopes;
-
- #endregion
-
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="MicrosoftClient"/> class.
- /// Requests a scope of "wl.basic" by default, but "wl.signin" is a good minimal alternative.
- /// </summary>
- /// <param name="appId">The app id.</param>
- /// <param name="appSecret">The app secret.</param>
- public MicrosoftClient(string appId, string appSecret)
- : this(appId, appSecret, "wl.basic")
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="MicrosoftClient"/> class.
- /// </summary>
- /// <param name="appId">The app id.</param>
- /// <param name="appSecret">The app secret.</param>
- /// <param name="requestedScopes">One or more requested scopes.</param>
- public MicrosoftClient(string appId, string appSecret, params string[] requestedScopes)
- : this("microsoft", appId, appSecret, requestedScopes) {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="MicrosoftClient"/> class.
- /// </summary>
- /// <param name="providerName">The provider name.</param>
- /// <param name="appId">The app id.</param>
- /// <param name="appSecret">The app secret.</param>
- /// <param name="requestedScopes">One or more requested scopes.</param>
- protected MicrosoftClient(string providerName, string appId, string appSecret, string[] requestedScopes)
- : base(providerName) {
- Requires.NotNullOrEmpty(appId, "appId");
- Requires.NotNullOrEmpty(appSecret, "appSecret");
-
- this.appId = appId;
- this.appSecret = appSecret;
- this.requestedScopes = requestedScopes;
- }
-
- #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>
- /// 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>
- /// <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", string.Join(" ", this.requestedScopes) },
- { "response_type", "code" },
- { "redirect_uri", returnUrl.AbsoluteUri },
- });
-
- return builder.Uri;
- }
-
- /// <summary>
- /// Given the access token, gets the logged-in user's data. The returned dictionary must include two keys 'id', and 'username'.
- /// </summary>
- /// <param name="accessToken">
- /// The access token of the current user.
- /// </param>
- /// <returns>
- /// A dictionary contains key-value pairs of user data
- /// </returns>
- protected override NameValueCollection GetUserData(string accessToken) {
- MicrosoftClientUserData graph;
- var request =
- WebRequest.Create(
- "https://apis.live.net/v5.0/me?access_token=" + MessagingUtilities.EscapeUriDataStringRfc3986(accessToken));
- using (var response = request.GetResponse()) {
- using (var responseStream = response.GetResponseStream()) {
- graph = JsonHelper.Deserialize<MicrosoftClientUserData>(responseStream);
- }
- }
-
- var userData = new NameValueCollection();
- userData.AddItemIfNotEmpty("id", graph.Id);
- userData.AddItemIfNotEmpty("username", graph.Name);
- userData.AddItemIfNotEmpty("name", graph.Name);
- userData.AddItemIfNotEmpty("link", graph.Link == null ? null : graph.Link.AbsoluteUri);
- userData.AddItemIfNotEmpty("gender", graph.Gender);
- userData.AddItemIfNotEmpty("firstname", graph.FirstName);
- userData.AddItemIfNotEmpty("lastname", graph.LastName);
- return userData;
- }
-
- /// <summary>
- /// Queries the access token from the specified authorization code.
- /// </summary>
- /// <param name="returnUrl">
- /// The return URL.
- /// </param>
- /// <param name="authorizationCode">
- /// The authorization code.
- /// </param>
- /// <returns>
- /// The query access token.
- /// </returns>
- protected override string QueryAccessToken(Uri returnUrl, string authorizationCode) {
- 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" },
- });
-
- WebRequest tokenRequest = WebRequest.Create(TokenEndpoint);
- tokenRequest.ContentType = "application/x-www-form-urlencoded";
- tokenRequest.ContentLength = entity.Length;
- tokenRequest.Method = "POST";
-
- using (Stream requestStream = tokenRequest.GetRequestStream()) {
- var writer = new StreamWriter(requestStream);
- writer.Write(entity);
- writer.Flush();
- }
-
- HttpWebResponse tokenResponse = (HttpWebResponse)tokenRequest.GetResponse();
- if (tokenResponse.StatusCode == HttpStatusCode.OK) {
- using (Stream responseStream = tokenResponse.GetResponseStream()) {
- var tokenData = JsonHelper.Deserialize<OAuth2AccessTokenData>(responseStream);
- if (tokenData != null) {
- return tokenData.AccessToken;
- }
- }
- }
-
- return null;
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClientUserData.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClientUserData.cs
deleted file mode 100644
index 3b55f7a..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClientUserData.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="MicrosoftClientUserData.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.ComponentModel;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Contains data of a Windows Live user.
- /// </summary>
- /// <remarks>
- /// Technically, this class doesn't need to be public, but because we want to make it serializable in medium trust, it has to be public.
- /// </remarks>
- [DataContract]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class MicrosoftClientUserData {
- #region Public Properties
-
- /// <summary>
- /// Gets or sets the first name.
- /// </summary>
- /// <value> The first name. </value>
- [DataMember(Name = "first_name")]
- public string FirstName { get; set; }
-
- /// <summary>
- /// Gets or sets the gender.
- /// </summary>
- /// <value> The gender. </value>
- [DataMember(Name = "gender")]
- public string Gender { get; set; }
-
- /// <summary>
- /// Gets or sets the id.
- /// </summary>
- /// <value> The id. </value>
- [DataMember(Name = "id")]
- public string Id { get; set; }
-
- /// <summary>
- /// Gets or sets the last name.
- /// </summary>
- /// <value> The last name. </value>
- [DataMember(Name = "last_name")]
- public string LastName { get; set; }
-
- /// <summary>
- /// Gets or sets the link.
- /// </summary>
- /// <value> The link. </value>
- [DataMember(Name = "link")]
- public Uri Link { get; set; }
-
- /// <summary>
- /// Gets or sets the name.
- /// </summary>
- /// <value> The name. </value>
- [DataMember(Name = "name")]
- public string Name { get; set; }
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2AccessTokenData.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2AccessTokenData.cs
deleted file mode 100644
index 5da24dd..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2AccessTokenData.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OAuth2AccessTokenData.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Captures the result of an access token request, including an optional refresh token.
- /// </summary>
- [DataContract]
- public class OAuth2AccessTokenData {
- #region Public Properties
-
- /// <summary>
- /// Gets or sets the access token.
- /// </summary>
- /// <value> The access token. </value>
- [DataMember(Name = "access_token")]
- public string AccessToken { get; set; }
-
- /// <summary>
- /// Gets or sets the refresh token.
- /// </summary>
- /// <value> The refresh token. </value>
- [DataMember(Name = "refresh_token")]
- public string RefreshToken { get; set; }
-
- /// <summary>
- /// Gets or sets the scope.
- /// </summary>
- /// <value> The scope. </value>
- [DataMember(Name = "scope")]
- public string Scope { get; set; }
-
- /// <summary>
- /// Gets or sets the type of the token.
- /// </summary>
- /// <value> The type of the token. </value>
- [DataMember(Name = "token_type")]
- public string TokenType { get; set; }
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs
deleted file mode 100644
index a795184..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs
+++ /dev/null
@@ -1,174 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OAuth2Client.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Web;
- using DotNetOpenAuth.Messaging;
- using Validation;
-
- /// <summary>
- /// Represents the base class for OAuth 2.0 clients
- /// </summary>
- public abstract class OAuth2Client : IAuthenticationClient {
- #region Constants and Fields
-
- /// <summary>
- /// The provider name.
- /// </summary>
- private readonly string providerName;
-
- #endregion
-
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="OAuth2Client"/> class with the specified provider name.
- /// </summary>
- /// <param name="providerName">
- /// Name of the provider.
- /// </param>
- protected OAuth2Client(string providerName) {
- Requires.NotNull(providerName, "providerName");
- this.providerName = providerName;
- }
-
- #endregion
-
- #region Public Properties
-
- /// <summary>
- /// Gets the name of the provider which provides authentication service.
- /// </summary>
- public string ProviderName {
- get {
- return this.providerName;
- }
- }
-
- #endregion
-
- #region Public Methods and Operators
-
- /// <summary>
- /// Attempts to authenticate users by forwarding them to an external website, and upon succcess or failure, redirect users back to the specified url.
- /// </summary>
- /// <param name="context">The context.</param>
- /// <param name="returnUrl">The return url after users have completed authenticating against external website.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// A task that completes with the asynchronous operation.
- /// </returns>
- public virtual Task RequestAuthenticationAsync(HttpContextBase context, Uri returnUrl, CancellationToken cancellationToken = default(CancellationToken)) {
- Requires.NotNull(context, "context");
- Requires.NotNull(returnUrl, "returnUrl");
-
- string redirectUrl = this.GetServiceLoginUrl(returnUrl).AbsoluteUri;
- context.Response.Redirect(redirectUrl, endResponse: true);
- return MessagingUtilities.CompletedTask;
- }
-
- /// <summary>
- /// Check if authentication succeeded after user is redirected back from the service provider.
- /// </summary>
- /// <param name="context">The context.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// An instance of <see cref="AuthenticationResult" /> containing authentication result.
- /// </returns>
- /// <exception cref="System.InvalidOperationException">Always thrown.</exception>
- public Task<AuthenticationResult> VerifyAuthenticationAsync(HttpContextBase context, CancellationToken cancellationToken = default(CancellationToken)) {
- throw new InvalidOperationException(WebResources.OAuthRequireReturnUrl);
- }
-
- /// <summary>
- /// Check if authentication succeeded after user is redirected back from the service provider.
- /// </summary>
- /// <param name="context">The context.</param>
- /// <param name="returnPageUrl">The return URL which should match the value passed to RequestAuthentication() method.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// An instance of <see cref="AuthenticationResult" /> containing authentication result.
- /// </returns>
- public virtual async Task<AuthenticationResult> VerifyAuthenticationAsync(HttpContextBase context, Uri returnPageUrl, CancellationToken cancellationToken = default(CancellationToken)) {
- Requires.NotNull(context, "context");
-
- string code = context.Request.QueryString["code"];
- if (string.IsNullOrEmpty(code)) {
- return AuthenticationResult.Failed;
- }
-
- string accessToken = this.QueryAccessToken(returnPageUrl, code);
- if (accessToken == null) {
- return AuthenticationResult.Failed;
- }
-
- var userData = this.GetUserData(accessToken);
- if (userData == null) {
- return AuthenticationResult.Failed;
- }
-
- // Some oAuth providers do not return value for the 'username' attribute.
- // In that case, try the 'name' attribute. If it's still unavailable, fall back to 'id'
- string id = userData["id"];
- string name = userData["username"] ?? userData["name"] ?? id;
-
- // add the access token to the user data dictionary just in case page developers want to use it
- userData["accesstoken"] = accessToken;
-
- return new AuthenticationResult(
- isSuccessful: true, provider: this.ProviderName, providerUserId: id, userName: name, extraData: userData);
- }
-
- #endregion
-
- #region Methods
-
- /// <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>
- /// <returns>
- /// An absolute URL.
- /// </returns>
- [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Login",
- Justification = "Login is used more consistently in ASP.Net")]
- protected abstract Uri GetServiceLoginUrl(Uri returnUrl);
-
- /// <summary>
- /// Given the access token, gets the logged-in user's data. The returned dictionary must include two keys 'id', and 'username'.
- /// </summary>
- /// <param name="accessToken">
- /// The access token of the current user.
- /// </param>
- /// <returns>
- /// A dictionary contains key-value pairs of user data
- /// </returns>
- protected abstract NameValueCollection GetUserData(string accessToken);
-
- /// <summary>
- /// Queries the access token from the specified authorization code.
- /// </summary>
- /// <param name="returnUrl">
- /// The return URL.
- /// </param>
- /// <param name="authorizationCode">
- /// The authorization code.
- /// </param>
- /// <returns>
- /// The access token
- /// </returns>
- protected abstract string QueryAccessToken(Uri returnUrl, string authorizationCode);
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/WindowsLiveClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/WindowsLiveClient.cs
deleted file mode 100644
index 5441ce5..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/WindowsLiveClient.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="WindowsLiveClient.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
-
- /// <summary>
- /// The WindowsLive client.
- /// </summary>
- /// <remarks>
- /// The WindowsLive brand is being replaced by Microsoft account brand.
- /// We keep this class for backward compatibility only.
- /// </remarks>
- [Obsolete("Use the MicrosoftClient class.")]
- public sealed class WindowsLiveClient : MicrosoftClient {
- /// <summary>
- /// Initializes a new instance of the <see cref="WindowsLiveClient"/> class.
- /// </summary>
- /// <param name="appId">The app id.</param>
- /// <param name="appSecret">The app secret.</param>
- public WindowsLiveClient(string appId, string appSecret) :
- base("windowslive", appId, appSecret) {
- }
- }
-} \ No newline at end of file
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs
deleted file mode 100644
index bb6e391..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="GoogleOpenIdClient.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
- using DotNetOpenAuth.OpenId.RelyingParty;
-
- /// <summary>
- /// Represents Google OpenID client.
- /// </summary>
- public sealed class GoogleOpenIdClient : OpenIdClient {
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="GoogleOpenIdClient"/> class.
- /// </summary>
- public GoogleOpenIdClient()
- : base("google", WellKnownProviders.Google) { }
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// Gets the extra data obtained from the response message when authentication is successful.
- /// </summary>
- /// <param name="response">
- /// The response message.
- /// </param>
- /// <returns>A dictionary of profile data; or null if no data is available.</returns>
- protected override NameValueCollection GetExtraData(IAuthenticationResponse response) {
- FetchResponse fetchResponse = response.GetExtension<FetchResponse>();
- if (fetchResponse != null) {
- var extraData = new NameValueCollection();
- extraData.AddItemIfNotEmpty("email", fetchResponse.GetAttributeValue(WellKnownAttributes.Contact.Email));
- extraData.AddItemIfNotEmpty("country", fetchResponse.GetAttributeValue(WellKnownAttributes.Contact.HomeAddress.Country));
- extraData.AddItemIfNotEmpty("firstName", fetchResponse.GetAttributeValue(WellKnownAttributes.Name.First));
- extraData.AddItemIfNotEmpty("lastName", fetchResponse.GetAttributeValue(WellKnownAttributes.Name.Last));
-
- return extraData;
- }
-
- return null;
- }
-
- /// <summary>
- /// Called just before the authentication request is sent to service provider.
- /// </summary>
- /// <param name="request">
- /// The request.
- /// </param>
- protected override void OnBeforeSendingAuthenticationRequest(IAuthenticationRequest request) {
- // Attribute Exchange extensions
- var fetchRequest = new FetchRequest();
- fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
- fetchRequest.Attributes.AddOptional(WellKnownAttributes.Contact.HomeAddress.Country);
- fetchRequest.Attributes.AddOptional(WellKnownAttributes.Name.First);
- fetchRequest.Attributes.AddOptional(WellKnownAttributes.Name.Last);
-
- request.AddExtension(fetchRequest);
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs
deleted file mode 100644
index 5a5e696..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OpenIdClient.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Web;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OpenId;
- using DotNetOpenAuth.OpenId.RelyingParty;
- using Validation;
-
- /// <summary>
- /// Base classes for OpenID clients.
- /// </summary>
- public class OpenIdClient : IAuthenticationClient {
- #region Constants and Fields
-
- /// <summary>
- /// The openid relying party.
- /// </summary>
- /// <remarks>
- /// Pass null as applicationStore to specify dumb mode
- /// </remarks>
- private static readonly OpenIdRelyingParty RelyingParty = new OpenIdRelyingParty(applicationStore: null);
-
- /// <summary>
- /// The provider identifier.
- /// </summary>
- private readonly Identifier providerIdentifier;
-
- /// <summary>
- /// The provider name.
- /// </summary>
- private readonly string providerName;
-
- #endregion
-
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="OpenIdClient"/> class.
- /// </summary>
- /// <param name="providerName">
- /// Name of the provider.
- /// </param>
- /// <param name="providerIdentifier">
- /// The provider identifier, which is the usually the login url of the specified provider.
- /// </param>
- public OpenIdClient(string providerName, Identifier providerIdentifier) {
- Requires.NotNullOrEmpty(providerName, "providerName");
- Requires.NotNull(providerIdentifier, "providerIdentifier");
-
- this.providerName = providerName;
- this.providerIdentifier = providerIdentifier;
- }
-
- #endregion
-
- #region Public Properties
-
- /// <summary>
- /// Gets the name of the provider which provides authentication service.
- /// </summary>
- public string ProviderName {
- get {
- return this.providerName;
- }
- }
-
- #endregion
-
- #region Public Methods and Operators
-
- /// <summary>
- /// Attempts to authenticate users by forwarding them to an external website, and upon succcess or failure, redirect users back to the specified url.
- /// </summary>
- /// <param name="context">The context of the current request.</param>
- /// <param name="returnUrl">The return url after users have completed authenticating against external website.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// A task that completes with the asynchronous operation.
- /// </returns>
- [SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings",
- Justification = "We don't have a Uri object handy.")]
- public virtual async Task RequestAuthenticationAsync(HttpContextBase context, Uri returnUrl, CancellationToken cancellationToken = default(CancellationToken)) {
- Requires.NotNull(returnUrl, "returnUrl");
-
- var realm = new Realm(returnUrl.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped));
- IAuthenticationRequest request = await RelyingParty.CreateRequestAsync(this.providerIdentifier, realm, returnUrl, cancellationToken);
-
- // give subclasses a chance to modify request message, e.g. add extension attributes, etc.
- this.OnBeforeSendingAuthenticationRequest(request);
-
- await request.RedirectToProviderAsync(context);
- }
-
- /// <summary>
- /// Check if authentication succeeded after user is redirected back from the service provider.
- /// </summary>
- /// <param name="context">The context of the current request.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// An instance of <see cref="AuthenticationResult" /> containing authentication result.
- /// </returns>
- /// <exception cref="System.InvalidOperationException">Thrown if no OpenID response was found in the incoming HTTP request.</exception>
- public virtual async Task<AuthenticationResult> VerifyAuthenticationAsync(HttpContextBase context, CancellationToken cancellationToken = default(CancellationToken)) {
- IAuthenticationResponse response = await RelyingParty.GetResponseAsync(context.Request, cancellationToken);
- if (response == null) {
- throw new InvalidOperationException(WebResources.OpenIDFailedToGetResponse);
- }
-
- if (response.Status == AuthenticationStatus.Authenticated) {
- string id = response.ClaimedIdentifier;
- var extraData = this.GetExtraData(response) ?? new NameValueCollection();
-
- // try to look up username from the 'username' or 'email' property. If not found, fall back to 'friendly id'
- string username = extraData["username"] ?? extraData["email"] ?? response.FriendlyIdentifierForDisplay;
-
- return new AuthenticationResult(true, this.ProviderName, id, username, extraData);
- }
-
- return AuthenticationResult.Failed;
- }
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// Gets the extra data obtained from the response message when authentication is successful.
- /// </summary>
- /// <param name="response">
- /// The response message.
- /// </param>
- /// <returns>Always null.</returns>
- protected virtual NameValueCollection GetExtraData(IAuthenticationResponse response) {
- return null;
- }
-
- /// <summary>
- /// Called just before the authentication request is sent to service provider.
- /// </summary>
- /// <param name="request">
- /// 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
deleted file mode 100644
index a5ee6b7..0000000
--- a/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="YahooOpenIdClient.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet.Clients {
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
- using DotNetOpenAuth.OpenId.RelyingParty;
-
- /// <summary>
- /// The yahoo open id client.
- /// </summary>
- public sealed class YahooOpenIdClient : OpenIdClient {
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="YahooOpenIdClient"/> class.
- /// </summary>
- public YahooOpenIdClient()
- : base("yahoo", WellKnownProviders.Yahoo) { }
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// Gets the extra data obtained from the response message when authentication is successful.
- /// </summary>
- /// <param name="response">
- /// The response message.
- /// </param>
- /// <returns>A dictionary of profile data; or null if no data is available.</returns>
- protected override NameValueCollection GetExtraData(IAuthenticationResponse response) {
- FetchResponse fetchResponse = response.GetExtension<FetchResponse>();
- if (fetchResponse != null) {
- var extraData = new NameValueCollection();
- extraData.AddItemIfNotEmpty("email", fetchResponse.GetAttributeValue(WellKnownAttributes.Contact.Email));
- extraData.AddItemIfNotEmpty("fullName", fetchResponse.GetAttributeValue(WellKnownAttributes.Name.FullName));
-
- return extraData;
- }
-
- return null;
- }
-
- /// <summary>
- /// Called just before the authentication request is sent to service provider.
- /// </summary>
- /// <param name="request">
- /// The request.
- /// </param>
- protected override void OnBeforeSendingAuthenticationRequest(IAuthenticationRequest request) {
- // Attribute Exchange extensions
- var fetchRequest = new FetchRequest();
- fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
- fetchRequest.Attributes.AddOptional(WellKnownAttributes.Name.FullName);
-
- request.AddExtension(fetchRequest);
- }
-
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/DotNetOpenAuth.AspNet.csproj b/src/DotNetOpenAuth.AspNet/DotNetOpenAuth.AspNet.csproj
deleted file mode 100644
index 2966042..0000000
--- a/src/DotNetOpenAuth.AspNet/DotNetOpenAuth.AspNet.csproj
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<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>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{51835086-9611-4C53-819B-F2D5C9320873}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <AssemblyName>DotNetOpenAuth.AspNet</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <CodeAnalysisRuleSet>ExtendedDesignGuidelineRules.ruleset</CodeAnalysisRuleSet>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <DefineConstants>TRACE</DefineConstants>
- </PropertyGroup>
- <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.props" />
- <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.Product.props" />
- <PropertyGroup>
- <RootNamespace>DotNetOpenAuth.AspNet</RootNamespace>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Net.Http" />
- <Reference Include="System.Net.Http.WebRequest" />
- <Reference Include="System.Runtime.Serialization" />
- <Reference Include="System.Web" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- <Reference Include="Validation, Version=2.0.0.0, Culture=neutral, PublicKeyToken=2fc06f0d701809a7, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\Validation.2.0.2.13022\lib\portable-windows8+net40+sl5+windowsphone8\Validation.dll</HintPath>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AuthenticationResult.cs" />
- <Compile Include="Clients\DictionaryExtensions.cs" />
- <Compile Include="Clients\OAuth2\AzureADClaims.cs" />
- <Compile Include="Clients\OAuth2\AzureADClient.cs" />
- <Compile Include="Clients\OAuth2\AzureADGraph.cs" />
- <Compile Include="Clients\OAuth2\AzureADHeader.cs" />
- <Compile Include="Clients\OAuth2\WindowsLiveClient.cs" />
- <Compile Include="IAuthenticationClient.cs" />
- <Compile Include="Clients\OAuth2\FacebookClient.cs" />
- <Compile Include="Clients\OAuth2\FacebookGraphData.cs" />
- <Compile Include="Clients\OAuth2\JsonHelper.cs" />
- <Compile Include="Clients\OAuth2\OAuth2AccessTokenData.cs" />
- <Compile Include="Clients\OAuth2\OAuth2Client.cs" />
- <Compile Include="Clients\OAuth2\MicrosoftClient.cs" />
- <Compile Include="Clients\OAuth2\MicrosoftClientUserData.cs" />
- <Compile Include="Clients\OAuth\DotNetOpenAuthWebConsumer.cs" />
- <Compile Include="Clients\OAuth\IOAuthWebWorker.cs" />
- <Compile Include="Clients\OAuth\LinkedInClient.cs" />
- <Compile Include="Clients\OAuth\OAuthClient.cs" />
- <Compile Include="Clients\OAuth\TwitterClient.cs" />
- <Compile Include="Clients\OpenID\GoogleOpenIdClient.cs" />
- <Compile Include="Clients\OpenID\OpenIdClient.cs" />
- <Compile Include="Clients\OpenID\YahooOpenIdClient.cs" />
- <Compile Include="UriHelper.cs" />
- <Compile Include="IOpenAuthDataProvider.cs" />
- <Compile Include="OpenAuthAuthenticationTicketHelper.cs" />
- <Compile Include="OpenAuthSecurityManager.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="WebResources.Designer.cs">
- <AutoGen>True</AutoGen>
- <DesignTime>True</DesignTime>
- <DependentUpon>WebResources.resx</DependentUpon>
- </Compile>
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="WebResources.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>WebResources.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\DotNetOpenAuth.Core\DotNetOpenAuth.Core.csproj">
- <Project>{60426312-6AE5-4835-8667-37EDEA670222}</Project>
- <Name>DotNetOpenAuth.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\DotNetOpenAuth.OAuth.Consumer\DotNetOpenAuth.OAuth.Consumer.csproj">
- <Project>{B202E40D-4663-4A2B-ACDA-865F88FF7CAA}</Project>
- <Name>DotNetOpenAuth.OAuth.Consumer</Name>
- </ProjectReference>
- <ProjectReference Include="..\DotNetOpenAuth.OAuth\DotNetOpenAuth.OAuth.csproj">
- <Project>{A288FCC8-6FCF-46DA-A45E-5F9281556361}</Project>
- <Name>DotNetOpenAuth.OAuth</Name>
- </ProjectReference>
- <ProjectReference Include="..\DotNetOpenAuth.OpenId.RelyingParty\DotNetOpenAuth.OpenId.RelyingParty.csproj">
- <Project>{F458AB60-BA1C-43D9-8CEF-EC01B50BE87B}</Project>
- <Name>DotNetOpenAuth.OpenId.RelyingParty</Name>
- </ProjectReference>
- <ProjectReference Include="..\DotNetOpenAuth.OpenId\DotNetOpenAuth.OpenId.csproj">
- <Project>{3896A32A-E876-4C23-B9B8-78E17D134CD3}</Project>
- <Name>DotNetOpenAuth.OpenId</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.targets" />
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))\EnlistmentInfo.targets" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))' != '' " />
- <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
-</Project> \ No newline at end of file
diff --git a/src/DotNetOpenAuth.AspNet/IAuthenticationClient.cs b/src/DotNetOpenAuth.AspNet/IAuthenticationClient.cs
deleted file mode 100644
index b13f0d1..0000000
--- a/src/DotNetOpenAuth.AspNet/IAuthenticationClient.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="IAuthenticationClient.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet {
- using System;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Web;
-
- /// <summary>
- /// Represents a client which can authenticate users via an external website/provider.
- /// </summary>
- public interface IAuthenticationClient {
- /// <summary>
- /// Gets the name of the provider which provides authentication service.
- /// </summary>
- string ProviderName { get; }
-
- /// <summary>
- /// Attempts to authenticate users by forwarding them to an external website, and upon succcess or failure, redirect users back to the specified url.
- /// </summary>
- /// <param name="context">The context of the current request.</param>
- /// <param name="returnUrl">The return url after users have completed authenticating against external website.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>A task that completes with the async operation.</returns>
- Task RequestAuthenticationAsync(HttpContextBase context, Uri returnUrl, CancellationToken cancellationToken = default(CancellationToken));
-
- /// <summary>
- /// Check if authentication succeeded after user is redirected back from the service provider.
- /// </summary>
- /// <param name="context">The context of the current request.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// An instance of <see cref="AuthenticationResult" /> containing authentication result.
- /// </returns>
- Task<AuthenticationResult> VerifyAuthenticationAsync(HttpContextBase context, CancellationToken cancellationToken = default(CancellationToken));
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/IOpenAuthDataProvider.cs b/src/DotNetOpenAuth.AspNet/IOpenAuthDataProvider.cs
deleted file mode 100644
index 12d929d..0000000
--- a/src/DotNetOpenAuth.AspNet/IOpenAuthDataProvider.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="IOpenAuthDataProvider.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet {
- /// <summary>
- /// Common methods available on identity issuers.
- /// </summary>
- public interface IOpenAuthDataProvider {
- #region Public Methods and Operators
-
- /// <summary>
- /// Get a user name from an identity provider and their own assigned user ID.
- /// </summary>
- /// <param name="openAuthProvider">
- /// The identity provider.
- /// </param>
- /// <param name="openAuthId">
- /// The issuer's ID for the user.
- /// </param>
- /// <returns>
- /// 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
deleted file mode 100644
index 63f89b7..0000000
--- a/src/DotNetOpenAuth.AspNet/OpenAuthAuthenticationTicketHelper.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OpenAuthAuthenticationTicketHelper.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet {
- using System;
- using System.Diagnostics;
- using System.Web;
- using System.Web.Security;
- using Validation;
-
- /// <summary>
- /// Helper methods for setting and retrieving a custom forms authentication ticket for delegation protocols.
- /// </summary>
- internal static class OpenAuthAuthenticationTicketHelper {
- #region Constants and Fields
-
- /// <summary>
- /// The open auth cookie token.
- /// </summary>
- private const string OpenAuthCookieToken = "OAuth";
-
- #endregion
-
- #region Public Methods and Operators
-
- /// <summary>
- /// Checks whether the specified HTTP request comes from an authenticated user.
- /// </summary>
- /// <param name="context">
- /// The context.
- /// </param>
- /// <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) {
- return false;
- }
-
- string encryptedCookieData = cookie.Value;
- if (string.IsNullOrEmpty(encryptedCookieData)) {
- return false;
- }
-
- try {
- FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(encryptedCookieData);
- return authTicket != null && !authTicket.Expired && authTicket.UserData == OpenAuthCookieToken;
- } catch (ArgumentException) {
- return false;
- }
- }
-
- /// <summary>
- /// Adds an authentication cookie to the user agent in the next HTTP response.
- /// </summary>
- /// <param name="context">
- /// The context.
- /// </param>
- /// <param name="userName">
- /// The user name.
- /// </param>
- /// <param name="createPersistentCookie">
- /// A value indicating whether the cookie should persist across sessions.
- /// </param>
- public static void SetAuthenticationTicket(HttpContextBase context, string userName, bool createPersistentCookie) {
- if (!context.Request.IsSecureConnection && FormsAuthentication.RequireSSL) {
- throw new HttpException(WebResources.ConnectionNotSecure);
- }
-
- HttpCookie cookie = GetAuthCookie(userName, createPersistentCookie);
- context.Response.Cookies.Add(cookie);
- }
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// Creates an HTTP authentication cookie.
- /// </summary>
- /// <param name="userName">
- /// The user name.
- /// </param>
- /// <param name="createPersistentCookie">
- /// A value indicating whether the cookie should last across sessions.
- /// </param>
- /// <returns>An authentication cookie.</returns>
- private static HttpCookie GetAuthCookie(string userName, bool createPersistentCookie) {
- Requires.NotNullOrEmpty(userName, "userName");
-
- var ticket = new FormsAuthenticationTicket(
- /* version */
- 2,
- userName,
- DateTime.Now,
- DateTime.Now.Add(FormsAuthentication.Timeout),
- createPersistentCookie,
- OpenAuthCookieToken,
- FormsAuthentication.FormsCookiePath);
-
- string encryptedTicket = FormsAuthentication.Encrypt(ticket);
- if (encryptedTicket == null || encryptedTicket.Length < 1) {
- throw new HttpException(WebResources.FailedToEncryptTicket);
- }
-
- var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket) {
- HttpOnly = true,
- Path = FormsAuthentication.FormsCookiePath
- };
-
- // only set Secure if FormsAuthentication requires SSL.
- // otherwise, leave it to default value
- if (FormsAuthentication.RequireSSL)
- {
- cookie.Secure = true;
- }
-
- if (FormsAuthentication.CookieDomain != null) {
- cookie.Domain = FormsAuthentication.CookieDomain;
- }
-
- if (ticket.IsPersistent) {
- cookie.Expires = ticket.Expiration;
- }
-
- return cookie;
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs b/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs
deleted file mode 100644
index 7669072..0000000
--- a/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs
+++ /dev/null
@@ -1,321 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OpenAuthSecurityManager.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet {
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Web;
- using System.Web.Security;
- using DotNetOpenAuth.AspNet.Clients;
- using DotNetOpenAuth.Messaging;
- using Validation;
-
- /// <summary>
- /// Manage authenticating with an external OAuth or OpenID provider
- /// </summary>
- public class OpenAuthSecurityManager {
- #region Constants and Fields
-
- /// <summary>
- /// Purposes string used for protecting the anti-XSRF token.
- /// </summary>
- private const string AntiXsrfPurposeString = "DotNetOpenAuth.AspNet.AntiXsrfToken.v1";
-
- /// <summary>
- /// The provider query string name.
- /// </summary>
- private const string ProviderQueryStringName = "__provider__";
-
- /// <summary>
- /// The query string name for session id.
- /// </summary>
- private const string SessionIdQueryStringName = "__sid__";
-
- /// <summary>
- /// The cookie name for session id.
- /// </summary>
- private const string SessionIdCookieName = "__csid__";
-
- /// <summary>
- /// The _authentication provider.
- /// </summary>
- private readonly IAuthenticationClient authenticationProvider;
-
- /// <summary>
- /// The _data provider.
- /// </summary>
- private readonly IOpenAuthDataProvider dataProvider;
-
- /// <summary>
- /// The _request context.
- /// </summary>
- private readonly HttpContextBase requestContext;
-
- #endregion
-
- #region Constructors and Destructors
-
- /// <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");
-
- this.requestContext = requestContext;
- this.dataProvider = dataProvider;
- this.authenticationProvider = provider;
- }
-
- #endregion
-
- #region Public Properties
-
- /// <summary>
- /// Gets a value indicating whether IsAuthenticatedWithOpenAuth.
- /// </summary>
- public bool IsAuthenticatedWithOpenAuth {
- get {
- return this.requestContext.Request.IsAuthenticated
- && OpenAuthAuthenticationTicketHelper.IsValidAuthenticationTicket(this.requestContext);
- }
- }
-
- #endregion
-
- #region Public Methods and Operators
-
- /// <summary>
- /// Gets the provider that is responding to an authentication request.
- /// </summary>
- /// <param name="context">
- /// The HTTP request context.
- /// </param>
- /// <returns>
- /// The provider name, if one is available.
- /// </returns>
- public static string GetProviderName(HttpContextBase context) {
- return context.Request.QueryString[ProviderQueryStringName];
- }
-
- /// <summary>
- /// Checks if the specified provider user id represents a valid account. If it does, log user in.
- /// </summary>
- /// <param name="providerUserId">
- /// The provider user id.
- /// </param>
- /// <param name="createPersistentCookie">
- /// if set to <c>true</c> create persistent cookie.
- /// </param>
- /// <returns>
- /// <c>true</c> if the login is successful.
- /// </returns>
- [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);
- if (string.IsNullOrEmpty(userName)) {
- return false;
- }
-
- OpenAuthAuthenticationTicketHelper.SetAuthenticationTicket(this.requestContext, userName, createPersistentCookie);
- return true;
- }
-
- /// <summary>
- /// Requests the specified provider to start the authentication by directing users to an external website
- /// </summary>
- /// <param name="returnUrl">The return url after user is authenticated.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// A task that completes with the asynchronous operation.
- /// </returns>
- public async Task RequestAuthenticationAsync(string returnUrl, CancellationToken cancellationToken = default(CancellationToken)) {
- // convert returnUrl to an absolute path
- Uri uri;
- if (!string.IsNullOrEmpty(returnUrl)) {
- uri = UriHelper.ConvertToAbsoluteUri(returnUrl, this.requestContext);
- }
- else {
- 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);
-
- // Guard against XSRF attack by injecting session id into the redirect url and response cookie.
- // Upon returning from the external provider, we'll compare the session id value in the query
- // string and the cookie. If they don't match, we'll reject the request.
- string sessionId = Guid.NewGuid().ToString("N");
- uri = uri.AttachQueryStringParameter(SessionIdQueryStringName, sessionId);
-
- // The cookie value will be the current username secured against the session id we just created.
- byte[] encryptedCookieBytes = MachineKeyUtil.Protect(Encoding.UTF8.GetBytes(GetUsername(this.requestContext)), AntiXsrfPurposeString, "Token: " + sessionId);
-
- var xsrfCookie = new HttpCookie(SessionIdCookieName, HttpServerUtility.UrlTokenEncode(encryptedCookieBytes)) {
- HttpOnly = true
- };
- if (FormsAuthentication.RequireSSL) {
- xsrfCookie.Secure = true;
- }
- this.requestContext.Response.Cookies.Add(xsrfCookie);
-
- // issue the redirect to the external auth provider
- await this.authenticationProvider.RequestAuthenticationAsync(this.requestContext, uri, cancellationToken);
- }
-
- /// <summary>
- /// Checks if user is successfully authenticated when user is redirected back to this user.
- /// </summary>
- /// <param name="returnUrl">The return Url which must match exactly the Url passed into RequestAuthentication() earlier.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>
- /// The result of the authentication.
- /// </returns>
- /// <remarks>
- /// This returnUrl parameter only applies to OAuth2 providers. For other providers, it ignores the returnUrl parameter.
- /// </remarks>
- public async Task<AuthenticationResult> VerifyAuthenticationAsync(string returnUrl, CancellationToken cancellationToken = default(CancellationToken)) {
- // check for XSRF attack
- string sessionId;
- bool successful = this.ValidateRequestAgainstXsrfAttack(out sessionId);
- if (!successful) {
- return new AuthenticationResult(
- isSuccessful: false,
- provider: this.authenticationProvider.ProviderName,
- providerUserId: null,
- userName: null,
- extraData: null);
- }
-
- // Only OAuth2 requires the return url value for the verify authenticaiton step
- OAuth2Client oauth2Client = this.authenticationProvider as OAuth2Client;
- if (oauth2Client != null) {
- // convert returnUrl to an absolute path
- Uri uri;
- if (!string.IsNullOrEmpty(returnUrl)) {
- uri = UriHelper.ConvertToAbsoluteUri(returnUrl, this.requestContext);
- }
- else {
- 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);
-
- // When we called RequestAuthentication(), we put the sessionId in the returnUrl query string.
- // Hence, we need to put it in the VerifyAuthentication url again to please FB/Microsoft account providers.
- uri = uri.AttachQueryStringParameter(SessionIdQueryStringName, sessionId);
-
- try {
- AuthenticationResult result = await oauth2Client.VerifyAuthenticationAsync(this.requestContext, uri, cancellationToken);
- 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,
- extraData: null);
- }
-
- return result;
- }
- catch (HttpException exception) {
- return new AuthenticationResult(exception.GetBaseException(), this.authenticationProvider.ProviderName);
- }
- }
- else {
- return await this.authenticationProvider.VerifyAuthenticationAsync(this.requestContext, cancellationToken);
- }
- }
-
- /// <summary>
- /// Returns the username of the current logged-in user.
- /// </summary>
- /// <param name="context">The HTTP request context.</param>
- /// <returns>The username, or String.Empty if anonymous.</returns>
- private static string GetUsername(HttpContextBase context) {
- string username = null;
- if (context.User.Identity.IsAuthenticated) {
- username = context.User.Identity.Name;
- }
- return username ?? string.Empty;
- }
-
- /// <summary>
- /// Validates the request against XSRF attack.
- /// </summary>
- /// <param name="sessionId">The session id embedded in the query string.</param>
- /// <returns>
- /// <c>true</c> if the request is safe. Otherwise, <c>false</c>.
- /// </returns>
- private bool ValidateRequestAgainstXsrfAttack(out string sessionId) {
- sessionId = null;
-
- // get the session id query string parameter
- string queryStringSessionId = this.requestContext.Request.QueryString[SessionIdQueryStringName];
-
- // verify that the query string value is a valid guid
- Guid guid;
- if (!Guid.TryParse(queryStringSessionId, out guid)) {
- return false;
- }
-
- // the cookie value should be the current username secured against this guid
- var cookie = this.requestContext.Request.Cookies[SessionIdCookieName];
- if (cookie == null || string.IsNullOrEmpty(cookie.Value)) {
- return false;
- }
-
- // extract the username embedded within the cookie
- // if there is any error at all (crypto, malformed, etc.), fail gracefully
- string usernameInCookie = null;
- try {
- byte[] encryptedCookieBytes = HttpServerUtility.UrlTokenDecode(cookie.Value);
- byte[] decryptedCookieBytes = MachineKeyUtil.Unprotect(encryptedCookieBytes, AntiXsrfPurposeString, "Token: " + queryStringSessionId);
- usernameInCookie = Encoding.UTF8.GetString(decryptedCookieBytes);
- }
- catch {
- return false;
- }
-
- string currentUsername = GetUsername(this.requestContext);
- bool successful = string.Equals(currentUsername, usernameInCookie, StringComparison.OrdinalIgnoreCase);
-
- if (successful) {
- // be a good citizen, clean up cookie when the authentication succeeds
- var xsrfCookie = new HttpCookie(SessionIdCookieName, string.Empty) {
- HttpOnly = true,
- Expires = DateTime.Now.AddYears(-1)
- };
- this.requestContext.Response.Cookies.Set(xsrfCookie);
- }
-
- sessionId = queryStringSessionId;
- return successful;
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/src/DotNetOpenAuth.AspNet/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.AspNet/Properties/AssemblyInfo.cs
deleted file mode 100644
index cfd2d11..0000000
--- a/src/DotNetOpenAuth.AspNet/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="AssemblyInfo.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
-[assembly: CLSCompliant(true)]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("c89b7e57-2735-4407-bcb9-dfe9bb9493a2")]
-
-#if StrongNameSigned
-
-[assembly: InternalsVisibleTo("DotNetOpenAuth.AspNet.Test, PublicKey=0024000004800000140100000602000000240000525341310008000001000100ff61f0ffd86a577730128d6b9daed5195c2ec729115934b8da0763ac4f12ae2416a11657976a3adc5fec78fe98b8e4f65b2f29b1c116eb761111315f4f10d7a9a827615610b49ae262fa8dd52d8181b54b2fcba7e2d81723f7922e65154482dd208f98c084c59fe028f5bcb227022acfe03aef64ac6ed80e86093ebe2dafbbb00583321b3ec81d275c65077310dfcb837f6c1ec85a3554ac0d04892bdc76647973fce74f9cbd1435d6adba79942eb4ce60b923a62dbb8eebfed3283dfce3aa8123ee108c095a7a70be3ca2e92059223e0bfbfb56302b90906ef8e4f649cd42eb436dd9ee1173fd141af9b3f5def5eefd15771e24c3de9ea1f2b0985cd3756199")]
-#else
-[assembly: InternalsVisibleTo("DotNetOpenAuth.AspNet.Test")]
-#endif
diff --git a/src/DotNetOpenAuth.AspNet/UriHelper.cs b/src/DotNetOpenAuth.AspNet/UriHelper.cs
deleted file mode 100644
index bdf2ed0..0000000
--- a/src/DotNetOpenAuth.AspNet/UriHelper.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="UriHelper.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet {
- using System;
- using System.Text.RegularExpressions;
- using System.Web;
- using DotNetOpenAuth.Messaging;
-
- /// <summary>
- /// The uri helper.
- /// </summary>
- internal static class UriHelper {
- /// <summary>
- /// The attach query string parameter.
- /// </summary>
- /// <param name="url">
- /// The url.
- /// </param>
- /// <param name="parameterName">
- /// The parameter name. This value should not be provided by an end user; the caller should
- /// ensure that this value comes only from a literal string.
- /// </param>
- /// <param name="parameterValue">
- /// The parameter value.
- /// </param>
- /// <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;
- if (query.Length > 1) {
- // remove the '?' character in front of the query string
- query = query.Substring(1);
- }
-
- string parameterPrefix = parameterName + "=";
-
- string encodedParameterValue = Uri.EscapeDataString(parameterValue);
-
- string newQuery = Regex.Replace(query, parameterPrefix + "[^\\&]*", parameterPrefix + encodedParameterValue);
- if (newQuery == query) {
- if (newQuery.Length > 0) {
- newQuery += "&";
- }
-
- newQuery = newQuery + parameterPrefix + encodedParameterValue;
- }
-
- builder.Query = newQuery;
-
- return builder.Uri;
- }
-
- /// <summary>
- /// Converts an app-relative url, e.g. ~/Content/Return.cshtml, to a full-blown url, e.g. http://mysite.com/Content/Return.cshtml
- /// </summary>
- /// <param name="returnUrl">
- /// The return URL.
- /// </param>
- /// <param name="context">
- /// The context.
- /// </param>
- /// <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);
- }
-
- if (!VirtualPathUtility.IsAbsolute(returnUrl)) {
- returnUrl = VirtualPathUtility.ToAbsolute(returnUrl);
- }
-
- Uri publicUrl = context.Request.GetPublicFacingUrl();
- return new Uri(publicUrl, returnUrl);
- }
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/WebResources.Designer.cs b/src/DotNetOpenAuth.AspNet/WebResources.Designer.cs
deleted file mode 100644
index da1d1ca..0000000
--- a/src/DotNetOpenAuth.AspNet/WebResources.Designer.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.18033
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace DotNetOpenAuth.AspNet {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class WebResources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal WebResources() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DotNetOpenAuth.AspNet.WebResources", typeof(WebResources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A setting in web.config requires a secure connection for this request but the current connection is not secured..
- /// </summary>
- internal static string ConnectionNotSecure {
- get {
- return ResourceManager.GetString("ConnectionNotSecure", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Unable to encrypt the authentication ticket..
- /// </summary>
- internal static string FailedToEncryptTicket {
- get {
- return ResourceManager.GetString("FailedToEncryptTicket", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to An OAuth data provider has already been registered for this application..
- /// </summary>
- internal static string OAuthDataProviderRegistered {
- get {
- return ResourceManager.GetString("OAuthDataProviderRegistered", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to This operation is not supported on the current provider. Call the overload of VerifyAuthentication() which accepts a return url..
- /// </summary>
- internal static string OAuthRequireReturnUrl {
- get {
- return ResourceManager.GetString("OAuthRequireReturnUrl", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Failed to obtain the authentication response from service provider..
- /// </summary>
- internal static string OpenIDFailedToGetResponse {
- get {
- return ResourceManager.GetString("OpenIDFailedToGetResponse", resourceCulture);
- }
- }
- }
-}
diff --git a/src/DotNetOpenAuth.AspNet/WebResources.resx b/src/DotNetOpenAuth.AspNet/WebResources.resx
deleted file mode 100644
index a491579..0000000
--- a/src/DotNetOpenAuth.AspNet/WebResources.resx
+++ /dev/null
@@ -1,135 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ConnectionNotSecure" xml:space="preserve">
- <value>A setting in web.config requires a secure connection for this request but the current connection is not secured.</value>
- </data>
- <data name="FailedToEncryptTicket" xml:space="preserve">
- <value>Unable to encrypt the authentication ticket.</value>
- </data>
- <data name="OAuthDataProviderRegistered" xml:space="preserve">
- <value>An OAuth data provider has already been registered for this application.</value>
- </data>
- <data name="OAuthRequireReturnUrl" xml:space="preserve">
- <value>This operation is not supported on the current provider. Call the overload of VerifyAuthentication() which accepts a return url.</value>
- </data>
- <data name="OpenIDFailedToGetResponse" xml:space="preserve">
- <value>Failed to obtain the authentication response from service provider.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/src/DotNetOpenAuth.AspNet/packages.config b/src/DotNetOpenAuth.AspNet/packages.config
deleted file mode 100644
index d32d62f..0000000
--- a/src/DotNetOpenAuth.AspNet/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
- <package id="Validation" version="2.0.2.13022" targetFramework="net45" />
-</packages> \ No newline at end of file
diff --git a/src/DotNetOpenAuth.sln b/src/DotNetOpenAuth.sln
index 9d80625..30d9717 100644
--- a/src/DotNetOpenAuth.sln
+++ b/src/DotNetOpenAuth.sln
@@ -129,10 +129,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OAuthServiceProvider", "..\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetOpenAuth.OpenIdOAuth", "DotNetOpenAuth.OpenIdOAuth\DotNetOpenAuth.OpenIdOAuth.csproj", "{4BFAA336-5DF3-4F27-82D3-06D13240E8AB}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetOpenAuth.AspNet", "DotNetOpenAuth.AspNet\DotNetOpenAuth.AspNet.csproj", "{51835086-9611-4C53-819B-F2D5C9320873}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetOpenAuth.AspNet.Test", "DotNetOpenAuth.AspNet.Test\DotNetOpenAuth.AspNet.Test.csproj", "{C23B217B-4D35-4A72-A1F7-FAEB4F39CB91}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetOpenAuth.OAuth.Common", "DotNetOpenAuth.OAuth.Common\DotNetOpenAuth.OAuth.Common.csproj", "{115217C5-22CD-415C-A292-0DD0238CDD89}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetOpenAuth.OAuth2.ClientAuthorization", "DotNetOpenAuth.OAuth2.ClientAuthorization\DotNetOpenAuth.OAuth2.ClientAuthorization.csproj", "{CCF3728A-B3D7-404A-9BC6-75197135F2D7}"
@@ -363,17 +359,6 @@ Global
{4BFAA336-5DF3-4F27-82D3-06D13240E8AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BFAA336-5DF3-4F27-82D3-06D13240E8AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BFAA336-5DF3-4F27-82D3-06D13240E8AB}.Release|Any CPU.Build.0 = Release|Any CPU
- {51835086-9611-4C53-819B-F2D5C9320873}.CodeAnalysis|Any CPU.ActiveCfg = CodeAnalysis|Any CPU
- {51835086-9611-4C53-819B-F2D5C9320873}.CodeAnalysis|Any CPU.Build.0 = CodeAnalysis|Any CPU
- {51835086-9611-4C53-819B-F2D5C9320873}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {51835086-9611-4C53-819B-F2D5C9320873}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {51835086-9611-4C53-819B-F2D5C9320873}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {51835086-9611-4C53-819B-F2D5C9320873}.Release|Any CPU.Build.0 = Release|Any CPU
- {C23B217B-4D35-4A72-A1F7-FAEB4F39CB91}.CodeAnalysis|Any CPU.ActiveCfg = Debug|Any CPU
- {C23B217B-4D35-4A72-A1F7-FAEB4F39CB91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C23B217B-4D35-4A72-A1F7-FAEB4F39CB91}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C23B217B-4D35-4A72-A1F7-FAEB4F39CB91}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C23B217B-4D35-4A72-A1F7-FAEB4F39CB91}.Release|Any CPU.Build.0 = Release|Any CPU
{115217C5-22CD-415C-A292-0DD0238CDD89}.CodeAnalysis|Any CPU.ActiveCfg = CodeAnalysis|Any CPU
{115217C5-22CD-415C-A292-0DD0238CDD89}.CodeAnalysis|Any CPU.Build.0 = CodeAnalysis|Any CPU
{115217C5-22CD-415C-A292-0DD0238CDD89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -422,7 +407,6 @@ Global
{57A7DD35-666C-4FA3-9A1B-38961E50CA27} = {8D4236F7-C49B-49D3-BA71-6B86C9514BDE}
{60426312-6AE5-4835-8667-37EDEA670222} = {8D4236F7-C49B-49D3-BA71-6B86C9514BDE}
{173E7B8D-E751-46E2-A133-F72297C0D2F4} = {8D4236F7-C49B-49D3-BA71-6B86C9514BDE}
- {51835086-9611-4C53-819B-F2D5C9320873} = {8D4236F7-C49B-49D3-BA71-6B86C9514BDE}
{115217C5-22CD-415C-A292-0DD0238CDD89} = {8D4236F7-C49B-49D3-BA71-6B86C9514BDE}
{3896A32A-E876-4C23-B9B8-78E17D134CD3} = {C7EF1823-3AA7-477E-8476-28929F5C05D2}
{F8284738-3B5D-4733-A511-38C23F4A763F} = {C7EF1823-3AA7-477E-8476-28929F5C05D2}