[Fixes #41] Api review changes

This commit is contained in:
Kiran Challa 2015-10-08 11:51:12 -07:00
parent eef2d5e94f
commit 475771250b
35 changed files with 108 additions and 183 deletions

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22711.0
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{84FE6872-A610-4CEC-855F-A84CBF1F40FC}"
EndProject
@ -10,12 +10,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
global.json = global.json
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Cors.Core", "src\Microsoft.AspNet.Cors.Core\Microsoft.AspNet.Cors.Core.xproj", "{C573AEE1-8D54-4A83-8D6B-61C85E8F713E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F32074C7-087C-46CC-A913-422BFD2D6E0A}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Cors.Core.Test", "test\Microsoft.AspNet.Cors.Core.Test\Microsoft.AspNet.Cors.Core.Test.xproj", "{B4F83A06-EB8E-4186-84C4-C6DAF7EB03D4}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Cors", "src\Microsoft.AspNet.Cors\Microsoft.AspNet.Cors.xproj", "{41349FCD-D1C4-47A6-82D0-D16D00A8D59D}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Cors.Test", "test\Microsoft.AspNet.Cors.Test\Microsoft.AspNet.Cors.Test.xproj", "{F05BE96F-F869-4408-A480-96935B4835EE}"
@ -32,14 +28,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C573AEE1-8D54-4A83-8D6B-61C85E8F713E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C573AEE1-8D54-4A83-8D6B-61C85E8F713E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C573AEE1-8D54-4A83-8D6B-61C85E8F713E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C573AEE1-8D54-4A83-8D6B-61C85E8F713E}.Release|Any CPU.Build.0 = Release|Any CPU
{B4F83A06-EB8E-4186-84C4-C6DAF7EB03D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4F83A06-EB8E-4186-84C4-C6DAF7EB03D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4F83A06-EB8E-4186-84C4-C6DAF7EB03D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4F83A06-EB8E-4186-84C4-C6DAF7EB03D4}.Release|Any CPU.Build.0 = Release|Any CPU
{41349FCD-D1C4-47A6-82D0-D16D00A8D59D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41349FCD-D1C4-47A6-82D0-D16D00A8D59D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41349FCD-D1C4-47A6-82D0-D16D00A8D59D}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -61,8 +49,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C573AEE1-8D54-4A83-8D6B-61C85E8F713E} = {84FE6872-A610-4CEC-855F-A84CBF1F40FC}
{B4F83A06-EB8E-4186-84C4-C6DAF7EB03D4} = {F32074C7-087C-46CC-A913-422BFD2D6E0A}
{41349FCD-D1C4-47A6-82D0-D16D00A8D59D} = {84FE6872-A610-4CEC-855F-A84CBF1F40FC}
{F05BE96F-F869-4408-A480-96935B4835EE} = {F32074C7-087C-46CC-A913-422BFD2D6E0A}
{8DC90D0F-9660-42AD-BE08-4A7643A8F46E} = {EEF80A8E-F334-4C66-9537-8D24D002149D}

View File

@ -9,8 +9,7 @@
"StrictSemanticVersionValidationRule"
],
"packages": {
"Microsoft.AspNet.Cors": { },
"Microsoft.AspNet.Cors.Core": { }
"Microsoft.AspNet.Cors": { }
}
},
"Default": { // Rules to run for packages not listed in any other set.

View File

@ -1,6 +1,5 @@
using System;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Cors.Core;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.DependencyInjection;

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>c573aee1-8d54-4a83-8d6b-61c85e8f713e</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -1,8 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Resources;
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: NeutralResourcesLanguage("en-US")]

View File

@ -1,46 +0,0 @@
// <auto-generated />
namespace Microsoft.AspNet.Cors.Core
{
using System.Globalization;
using System.Reflection;
using System.Resources;
internal static class Resources
{
private static readonly ResourceManager _resourceManager
= new ResourceManager("Microsoft.AspNet.Cors.Core.Resources", typeof(Resources).GetTypeInfo().Assembly);
/// <summary>
/// PreflightMaxAge must be greater than or equal to 0.
/// </summary>
internal static string PreflightMaxAgeOutOfRange
{
get { return GetString("PreflightMaxAgeOutOfRange"); }
}
/// <summary>
/// PreflightMaxAge must be greater than or equal to 0.
/// </summary>
internal static string FormatPreflightMaxAgeOutOfRange()
{
return GetString("PreflightMaxAgeOutOfRange");
}
private static string GetString(string name, params string[] formatterNames)
{
var value = _resourceManager.GetString(name);
System.Diagnostics.Debug.Assert(value != null);
if (formatterNames != null)
{
for (var i = 0; i < formatterNames.Length; i++)
{
value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}");
}
}
return value;
}
}
}

View File

@ -1,21 +0,0 @@
{
"version": "6.0.0-*",
"repository": {
"type": "git",
"url": "https://github.com/aspnet/cors"
},
"compilationOptions": {
"warningsAsErrors": true
},
"dependencies": {
"Microsoft.AspNet.Http.Extensions": "1.0.0-*",
"Microsoft.Extensions.Configuration.Abstractions": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-*",
"Microsoft.Extensions.OptionsModel": "1.0.0-*"
},
"frameworks" : {
"dnx451" : { },
"dnxcore50" : { }
}
}

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNet.Cors.Core
namespace Microsoft.AspNet.Cors.Infrastructure
{
/// <summary>
/// CORS-related constants.

View File

@ -4,11 +4,10 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Cors.Core;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNet.Cors
namespace Microsoft.AspNet.Cors.Infrastructure
{
/// <summary>
/// An ASP.NET middleware for handling CORS.

View File

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Cors;
using Microsoft.AspNet.Cors.Infrastructure;
namespace Microsoft.AspNet.Builder
{

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace Microsoft.AspNet.Cors.Core
namespace Microsoft.AspNet.Cors.Infrastructure
{
/// <summary>
/// Provides programmatic configuration for Cors.

View File

@ -3,10 +3,9 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace Microsoft.AspNet.Cors.Core
namespace Microsoft.AspNet.Cors.Infrastructure
{
/// <summary>
/// Defines the policy for Cross-Origin requests based on the CORS specifications.
@ -124,7 +123,7 @@ namespace Microsoft.AspNet.Cors.Core
builder.Append(", AllowAnyOrigin: ");
builder.Append(AllowAnyOrigin);
builder.Append(", PreflightMaxAge: ");
builder.Append(PreflightMaxAge.HasValue ?
builder.Append(PreflightMaxAge.HasValue ?
PreflightMaxAge.Value.TotalSeconds.ToString() : "null");
builder.Append(", SupportsCredentials: ");
builder.Append(SupportsCredentials);

View File

@ -3,9 +3,8 @@
using System;
using System.Linq;
using Microsoft.AspNet.Cors.Core;
namespace Microsoft.AspNet.Cors
namespace Microsoft.AspNet.Cors.Infrastructure
{
/// <summary>
/// Exposes methods to build a policy.

View File

@ -3,11 +3,9 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
namespace Microsoft.AspNet.Cors.Core
namespace Microsoft.AspNet.Cors.Infrastructure
{
/// <summary>
/// Results returned by <see cref="ICorsService"/>.

View File

@ -9,7 +9,7 @@ using Microsoft.AspNet.Http;
using Microsoft.Extensions.OptionsModel;
using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNet.Cors.Core
namespace Microsoft.AspNet.Cors.Infrastructure
{
/// <summary>
/// Default implementation of <see cref="ICorsService"/>.

View File

@ -2,11 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Cors;
using Microsoft.AspNet.Cors.Core;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNet.Cors.Infrastructure;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Internal;
namespace Microsoft.Extensions.DependencyInjection
{

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.OptionsModel;
namespace Microsoft.AspNet.Cors.Core
namespace Microsoft.AspNet.Cors.Infrastructure
{
/// <inheritdoc />
public class DefaultCorsPolicyProvider : ICorsPolicyProvider

View File

@ -2,8 +2,9 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Cors.Infrastructure;
namespace Microsoft.AspNet.Cors.Core
namespace Microsoft.AspNet.Cors
{
/// <inheritdoc />
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]

View File

@ -2,8 +2,9 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Cors.Infrastructure;
namespace Microsoft.AspNet.Cors.Core
namespace Microsoft.AspNet.Cors
{
/// <inheritdoc />
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]

View File

@ -4,7 +4,7 @@
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
namespace Microsoft.AspNet.Cors.Core
namespace Microsoft.AspNet.Cors.Infrastructure
{
/// <summary>
/// A type which can provide a <see cref="CorsPolicy"/> for a particular <see cref="HttpContext"/>.

View File

@ -3,7 +3,7 @@
using Microsoft.AspNet.Http;
namespace Microsoft.AspNet.Cors.Core
namespace Microsoft.AspNet.Cors.Infrastructure
{
/// <summary>
/// A type which can evaluate a policy for a particular <see cref="HttpContext"/>.
@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Cors.Core
/// <param name="context">The <see cref="HttpContext"/> associated with the call.</param>
/// <param name="policy">The <see cref="CorsPolicy"/> which needs to be evaluated.</param>
/// <returns>A <see cref="CorsResult"/> which contains the result of policy evaluation and can be
/// used by the caller to set apporpriate response headers.</returns>
/// used by the caller to set appropriate response headers.</returns>
CorsResult EvaluatePolicy(HttpContext context, CorsPolicy policy);

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNet.Cors.Core
namespace Microsoft.AspNet.Cors.Infrastructure
{
/// <summary>
/// An interface which can be used to identify a type which provides metdata to disable cors for a resource.

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNet.Cors.Core
namespace Microsoft.AspNet.Cors.Infrastructure
{
/// <summary>
/// An interface which can be used to identify a type which provides metadata needed for enabling CORS support.

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.AspNet.Cors {
using System;
using System.Reflection;
/// <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.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
internal Resources() {
}
/// <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("Microsoft.AspNet.Cors.Resources", typeof(Resources).GetTypeInfo().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 PreflightMaxAge must be greater than or equal to 0..
/// </summary>
internal static string PreflightMaxAgeOutOfRange {
get {
return ResourceManager.GetString("PreflightMaxAgeOutOfRange", resourceCulture);
}
}
}
}

View File

@ -8,11 +8,14 @@
"warningsAsErrors": true
},
"dependencies": {
"Microsoft.AspNet.Cors.Core": "6.0.0-*"
"Microsoft.AspNet.Http.Extensions": "1.0.0-*",
"Microsoft.Extensions.Configuration.Abstractions": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-*",
"Microsoft.Extensions.OptionsModel": "1.0.0-*"
},
"frameworks" : {
"dnx451" : { },
"dnxcore50" : { }
"frameworks": {
"dnx451": { },
"dnxcore50": { }
}
}

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>b4f83a06-eb8e-4186-84c4-c6daf7eb03d4</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -1,17 +0,0 @@
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Cors.Core": "6.0.0-*",
"Microsoft.AspNet.Http": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"commands": {
"test": "xunit.runner.aspnet"
},
"frameworks" : {
"dnx451": { },
"dnxcore50": { }
}
}

View File

@ -5,7 +5,6 @@ using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Cors.Core;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Internal;
using Microsoft.AspNet.TestHost;
@ -13,7 +12,7 @@ using Microsoft.Extensions.DependencyInjection;
using Moq;
using Xunit;
namespace Microsoft.AspNet.Cors.Test
namespace Microsoft.AspNet.Cors.Infrastructure
{
public class CorsMiddlewareTests
{

View File

@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace Microsoft.AspNet.Cors.Core.Test
namespace Microsoft.AspNet.Cors.Infrastructure
{
public class CorsPolicyBuilderTests
{

View File

@ -4,7 +4,7 @@
using System;
using Xunit;
namespace Microsoft.AspNet.Cors.Core.Test
namespace Microsoft.AspNet.Cors.Infrastructure
{
public class CorsPolicyTest
{

View File

@ -4,7 +4,7 @@
using System;
using Xunit;
namespace Microsoft.AspNet.Cors.Core.Test
namespace Microsoft.AspNet.Cors.Infrastructure
{
public class CorsResultTest
{
@ -56,7 +56,7 @@ namespace Microsoft.AspNet.Cors.Core.Test
corsResult.AllowedHeaders.Add("baz");
corsResult.AllowedMethods.Add("GET");
// Act
// Act
var result = corsResult.ToString();
// Assert

View File

@ -6,7 +6,7 @@ using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Internal;
using Xunit;
namespace Microsoft.AspNet.Cors.Core.Test
namespace Microsoft.AspNet.Cors.Infrastructure
{
public class CorsServiceTests
{

View File

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Http.Internal;
using Xunit;
namespace Microsoft.AspNet.Cors.Core.Test
namespace Microsoft.AspNet.Cors.Infrastructure
{
public class DefaultPolicyProviderTests
{

View File

@ -3,7 +3,7 @@
using Microsoft.Extensions.OptionsModel;
namespace Microsoft.AspNet.Cors.Core.Test
namespace Microsoft.AspNet.Cors.Infrastructure
{
public class TestCorsOptions : IOptions<CorsOptions>
{