forked from DotNetOpenAuth/DotNetOpenAuth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves all MVC dependencies from core assemblies to a separate assembly.
I still need to add DNOA.Mvc to some build and package authoring.
- Loading branch information
Showing
15 changed files
with
251 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||
<metadata> | ||
<id>DotNetOpenAuth.Mvc</id> | ||
<version>$version$</version> | ||
<title>DotNetOpenAuth MVC extensions</title> | ||
<authors>Andrew Arnott</authors> | ||
<owners>Outercurve Foundation</owners> | ||
<projectUrl>http://www.dotnetopenauth.net/</projectUrl> | ||
<iconUrl>https://github.com/AArnott/dotnetopenid/raw/v3.4/doc/logo/dnoa-logo_32x32.png</iconUrl> | ||
<licenseUrl>http://www.opensource.org/licenses/ms-pl.html</licenseUrl> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<summary>Provides the HttpResponseMessage.AsActionResult() extension method.</summary> | ||
<dependencies> | ||
<dependency id="DotNetOpenAuth.Core" version="[$version$]" /> | ||
<dependency id="Microsoft.AspNet.Mvc" version="[5.0.0,6.0)" /> | ||
<dependency id="Microsoft.AspNet.Razor" version="[3.0.0,4.0)" /> | ||
<dependency id="Microsoft.AspNet.WebPages" version="[3.0.0,4.0)" /> | ||
<dependency id="Microsoft.Bcl" version="[1.1.3,2.0)" /> | ||
<dependency id="Microsoft.Bcl.Build" version="[1.0.10,2.0)" /> | ||
<dependency id="Microsoft.Net.Http" version="[2.2.15,3.0)" /> | ||
<dependency id="Microsoft.Web.Infrastructure" version="[1.0.0.0,2.0)" /> | ||
<dependency id="Validation" version="[2.0.2.13022,3.0)" /> | ||
</dependencies> | ||
</metadata> | ||
<files> | ||
<file src="$OutputPath45$$signedSubPath$$identity$.dll" target="lib\net45-full\" /> | ||
<file src="$OutputPath45$$identity$.pdb" target="lib\net45-full\" /> | ||
<file src="$OutputPath45$$identity$.xml" target="lib\net45-full\" /> | ||
|
||
<file src="..\src\$Identity$\**\*.cs" target="src" exclude="..\src\$Identity$\obj\**" /> | ||
<file src="$GeneratedAssemblyInfoSourceFile$" target="src" /> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="log4net" version="2.0.2" targetFramework="net45" /> | ||
<package id="Microsoft.AspNet.Mvc" version="5.0.0" targetFramework="net45" /> | ||
<package id="Microsoft.AspNet.Razor" version="3.0.0" targetFramework="net45" /> | ||
<package id="Microsoft.AspNet.WebPages" version="3.0.0" targetFramework="net45" /> | ||
<package id="Microsoft.Bcl" version="1.1.3" targetFramework="net45" /> | ||
<package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="net45" /> | ||
<package id="Microsoft.Net.Http" version="2.2.15" targetFramework="net45" /> | ||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" /> | ||
<package id="NLog" version="2.1.0" targetFramework="net45" /> | ||
<package id="Validation" version="2.0.2.13022" targetFramework="net45" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.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> | ||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> | ||
</PropertyGroup> | ||
<Import Project="$(ProjectRoot)tools\DotNetOpenAuth.props" /> | ||
<PropertyGroup> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{9D308EF2-2712-4F83-A14C-18BF08D45526}</ProjectGuid> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<AssemblyName>DotNetOpenAuth.Mvc</AssemblyName> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
</PropertyGroup> | ||
<Import Project="$(ProjectRoot)tools\DotNetOpenAuth.Product.props" /> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<Private>True</Private> | ||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Net.Http.Extensions"> | ||
<HintPath>..\packages\Microsoft.Net.Http.2.2.15\lib\net45\System.Net.Http.Extensions.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Net.Http.Primitives"> | ||
<HintPath>..\packages\Microsoft.Net.Http.2.2.15\lib\net45\System.Net.Http.Primitives.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Net.Http.WebRequest" /> | ||
<Reference Include="System.Web" /> | ||
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.Helpers.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.0.0\lib\net45\System.Web.Mvc.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\packages\Microsoft.AspNet.Razor.3.0.0\lib\net45\System.Web.Razor.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.WebPages.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.WebPages.Deployment.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.WebPages.Razor.dll</HintPath> | ||
</Reference> | ||
<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"> | ||
<HintPath>..\packages\Validation.2.0.2.13022\lib\portable-windows8+net40+sl5+windowsphone8\Validation.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="MvcExtensions.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\DotNetOpenAuth.Core\DotNetOpenAuth.Core.csproj"> | ||
<Project>{60426312-6ae5-4835-8667-37edea670222}</Project> | ||
<Name>DotNetOpenAuth.Core</Name> | ||
</ProjectReference> | ||
</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" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> | ||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" /> | ||
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''"> | ||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" /> | ||
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="MvcExtensions.cs" company="Andrew Arnott"> | ||
// Copyright (c) Andrew Arnott. All rights reserved. | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
namespace DotNetOpenAuth.Messaging | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net.Http; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Web.Mvc; | ||
using DotNetOpenAuth.Messaging; | ||
using Validation; | ||
|
||
/// <summary> | ||
/// DotNetOpenAuth extensions for ASP.NET MVC. | ||
/// </summary> | ||
public static class MvcExtensions { | ||
/// <summary> | ||
/// Wraps a response message as an MVC <see cref="ActionResult"/> so it can be conveniently returned from an MVC controller's action method. | ||
/// </summary> | ||
/// <param name="response">The response message.</param> | ||
/// <returns>An <see cref="ActionResult"/> instance.</returns> | ||
public static ActionResult AsActionResult(this HttpResponseMessage response) { | ||
Requires.NotNull(response, "response"); | ||
return new HttpResponseMessageActionResult(response); | ||
} | ||
|
||
/// <summary> | ||
/// An MVC <see cref="ActionResult"/> that wraps an <see cref="HttpResponseMessage"/> | ||
/// </summary> | ||
private class HttpResponseMessageActionResult : ActionResult { | ||
/// <summary> | ||
/// The wrapped response. | ||
/// </summary> | ||
private readonly HttpResponseMessage response; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="HttpResponseMessageActionResult"/> class. | ||
/// </summary> | ||
/// <param name="response">The response.</param> | ||
internal HttpResponseMessageActionResult(HttpResponseMessage response) { | ||
Requires.NotNull(response, "response"); | ||
this.response = response; | ||
} | ||
|
||
/// <summary> | ||
/// Enables processing of the result of an action method by a custom type that inherits from the <see cref="T:System.Web.Mvc.ActionResult" /> class. | ||
/// </summary> | ||
/// <param name="context">The context in which the result is executed. The context information includes the controller, HTTP content, request context, and route data.</param> | ||
public override void ExecuteResult(ControllerContext context) { | ||
// Sadly, MVC doesn't support writing to the response stream asynchronously. | ||
this.response.SendAsync(context.HttpContext).GetAwaiter().GetResult(); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.