Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Commit 9743b59

Browse files
committed
Merge branch 'release' of github.com:aspnet/Security into release
2 parents de5c079 + d7b389e commit 9743b59

File tree

87 files changed

+4265
-1027
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+4265
-1027
lines changed

NuGet.Config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<configuration>
33
<packageSources>
44
<add key="NuGet.org" value="https://nuget.org/api/v2/" />
5+
<add key="AzureADNighty" value="http://www.myget.org/F/azureadwebstacknightly"/>
56
</packageSources>
67
</configuration>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ ASP.NET Security
33

44
ASP.NET Security contains the security and authorization middlewares for ASP.NET vNext.
55

6-
This project is part of ASP.NET vNext. You can find samples, documentation and getting started instructions for ASP.NET vNext at the [Home](https://github.com/aspnet/home) repo.
6+
This project is part of ASP.NET 5. You can find samples, documentation and getting started instructions for ASP.NET 5 at the [Home](https://github.com/aspnet/home) repo.

Security.sln

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
4-
VisualStudioVersion = 14.0.22013.1
4+
VisualStudioVersion = 14.0.22422.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{4D2B6A51-2F9F-44F5-8131-EA5CAC053652}"
77
EndProject
@@ -36,6 +36,12 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Security.O
3636
EndProject
3737
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CookieSessionSample", "samples\CookieSessionSample\CookieSessionSample.kproj", "{19711880-46DA-4A26-9E0F-9B2E41D27651}"
3838
EndProject
39+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "OpenIdConnectSample", "samples\OpenIdConnectSample\OpenIdConnectSample.kproj", "{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}"
40+
EndProject
41+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Security.OAuthBearer", "src\Microsoft.AspNet.Security.OAuthBearer\Microsoft.AspNet.Security.OAuthBearer.kproj", "{2755BFE5-7421-4A31-A644-F817DF5CAA98}"
42+
EndProject
43+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Security.OpenIdConnect", "src\Microsoft.AspNet.Security.OpenIdConnect\Microsoft.AspNet.Security.OpenIdConnect.kproj", "{674D128E-83BB-481A-A9D9-6D47872E1FC8}"
44+
EndProject
3945
Global
4046
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4147
Debug|Any CPU = Debug|Any CPU
@@ -156,6 +162,42 @@ Global
156162
{19711880-46DA-4A26-9E0F-9B2E41D27651}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
157163
{19711880-46DA-4A26-9E0F-9B2E41D27651}.Release|Mixed Platforms.Build.0 = Release|Any CPU
158164
{19711880-46DA-4A26-9E0F-9B2E41D27651}.Release|x86.ActiveCfg = Release|Any CPU
165+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
166+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}.Debug|Any CPU.Build.0 = Debug|Any CPU
167+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
168+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
169+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}.Debug|x86.ActiveCfg = Debug|Any CPU
170+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}.Debug|x86.Build.0 = Debug|Any CPU
171+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}.Release|Any CPU.ActiveCfg = Release|Any CPU
172+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}.Release|Any CPU.Build.0 = Release|Any CPU
173+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
174+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
175+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}.Release|x86.ActiveCfg = Release|Any CPU
176+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B}.Release|x86.Build.0 = Release|Any CPU
177+
{2755BFE5-7421-4A31-A644-F817DF5CAA98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
178+
{2755BFE5-7421-4A31-A644-F817DF5CAA98}.Debug|Any CPU.Build.0 = Debug|Any CPU
179+
{2755BFE5-7421-4A31-A644-F817DF5CAA98}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
180+
{2755BFE5-7421-4A31-A644-F817DF5CAA98}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
181+
{2755BFE5-7421-4A31-A644-F817DF5CAA98}.Debug|x86.ActiveCfg = Debug|Any CPU
182+
{2755BFE5-7421-4A31-A644-F817DF5CAA98}.Debug|x86.Build.0 = Debug|Any CPU
183+
{2755BFE5-7421-4A31-A644-F817DF5CAA98}.Release|Any CPU.ActiveCfg = Release|Any CPU
184+
{2755BFE5-7421-4A31-A644-F817DF5CAA98}.Release|Any CPU.Build.0 = Release|Any CPU
185+
{2755BFE5-7421-4A31-A644-F817DF5CAA98}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
186+
{2755BFE5-7421-4A31-A644-F817DF5CAA98}.Release|Mixed Platforms.Build.0 = Release|Any CPU
187+
{2755BFE5-7421-4A31-A644-F817DF5CAA98}.Release|x86.ActiveCfg = Release|Any CPU
188+
{2755BFE5-7421-4A31-A644-F817DF5CAA98}.Release|x86.Build.0 = Release|Any CPU
189+
{674D128E-83BB-481A-A9D9-6D47872E1FC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
190+
{674D128E-83BB-481A-A9D9-6D47872E1FC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
191+
{674D128E-83BB-481A-A9D9-6D47872E1FC8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
192+
{674D128E-83BB-481A-A9D9-6D47872E1FC8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
193+
{674D128E-83BB-481A-A9D9-6D47872E1FC8}.Debug|x86.ActiveCfg = Debug|Any CPU
194+
{674D128E-83BB-481A-A9D9-6D47872E1FC8}.Debug|x86.Build.0 = Debug|Any CPU
195+
{674D128E-83BB-481A-A9D9-6D47872E1FC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
196+
{674D128E-83BB-481A-A9D9-6D47872E1FC8}.Release|Any CPU.Build.0 = Release|Any CPU
197+
{674D128E-83BB-481A-A9D9-6D47872E1FC8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
198+
{674D128E-83BB-481A-A9D9-6D47872E1FC8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
199+
{674D128E-83BB-481A-A9D9-6D47872E1FC8}.Release|x86.ActiveCfg = Release|Any CPU
200+
{674D128E-83BB-481A-A9D9-6D47872E1FC8}.Release|x86.Build.0 = Release|Any CPU
159201
EndGlobalSection
160202
GlobalSection(SolutionProperties) = preSolution
161203
HideSolutionNode = FALSE
@@ -172,5 +214,8 @@ Global
172214
{1FCF26C2-A3C7-4308-B698-4AFC3560BC0C} = {4D2B6A51-2F9F-44F5-8131-EA5CAC053652}
173215
{4A636011-68EE-4CE5-836D-EA8E13CF71E4} = {4D2B6A51-2F9F-44F5-8131-EA5CAC053652}
174216
{19711880-46DA-4A26-9E0F-9B2E41D27651} = {F8C0AA27-F3FB-4286-8E4C-47EF86B539FF}
217+
{BEF0F5C3-EF4E-4649-9C49-D5E279A3CA2B} = {F8C0AA27-F3FB-4286-8E4C-47EF86B539FF}
218+
{2755BFE5-7421-4A31-A644-F817DF5CAA98} = {4D2B6A51-2F9F-44F5-8131-EA5CAC053652}
219+
{674D128E-83BB-481A-A9D9-6D47872E1FC8} = {4D2B6A51-2F9F-44F5-8131-EA5CAC053652}
175220
EndGlobalSection
176221
EndGlobal

build.cmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ IF EXIST packages\KoreBuild goto run
1919
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
2020
.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion
2121

22-
IF "%SKIP_KRE_INSTALL%"=="1" goto run
23-
CALL packages\KoreBuild\build\kvm upgrade -runtime CLR -x86
24-
CALL packages\KoreBuild\build\kvm install default -runtime CoreCLR -x86
22+
IF "%SKIP_DOTNET_INSTALL%"=="1" goto run
23+
CALL packages\KoreBuild\build\dotnetsdk upgrade -runtime CLR -x86
24+
CALL packages\KoreBuild\build\dotnetsdk install default -runtime CoreCLR -x86
2525

2626
:run
27-
CALL packages\KoreBuild\build\kvm use default -runtime CLR -x86
27+
CALL packages\KoreBuild\build\dotnetsdk use default -runtime CLR -x86
2828
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ if test ! -d packages/KoreBuild; then
2828
fi
2929

3030
if ! type k > /dev/null 2>&1; then
31-
source packages/KoreBuild/build/kvm.sh
31+
source packages/KoreBuild/build/dotnetsdk.sh
3232
fi
3333

3434
if ! type k > /dev/null 2>&1; then
35-
kvm upgrade
35+
dotnetsdk upgrade
3636
fi
3737

3838
mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
8+
<PropertyGroup Label="Globals">
9+
<ProjectGuid>bef0f5c3-ef4e-4649-9c49-d5e279a3ca2b</ProjectGuid>
10+
<RootNamespace>OpenIDConnectSample</RootNamespace>
11+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
12+
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
13+
</PropertyGroup>
14+
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
15+
<AssemblyName>OpenIDConnectSample</AssemblyName>
16+
</PropertyGroup>
17+
<PropertyGroup>
18+
<SchemaVersion>2.0</SchemaVersion>
19+
<DevelopmentServerPort>42023</DevelopmentServerPort>
20+
<CommandLineArguments />
21+
<DebugTarget>
22+
</DebugTarget>
23+
</PropertyGroup>
24+
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
25+
<ProjectExtensions>
26+
<VisualStudio>
27+
<UserProperties project_1json__JSONSchema="http://www.asp.net/media/4878834/project.json" />
28+
</VisualStudio>
29+
</ProjectExtensions>
30+
</Project>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using Microsoft.AspNet.Builder;
2+
using Microsoft.AspNet.Http;
3+
using Microsoft.AspNet.Http.Security;
4+
using Microsoft.AspNet.Security;
5+
using Microsoft.AspNet.Security.Cookies;
6+
using Microsoft.AspNet.Security.OpenIdConnect;
7+
using Microsoft.Framework.DependencyInjection;
8+
9+
namespace OpenIdConnectSample
10+
{
11+
public class Startup
12+
{
13+
public void Configure(IApplicationBuilder app)
14+
{
15+
app.UseServices(services =>
16+
{
17+
services.AddDataProtection();
18+
services.Configure<ExternalAuthenticationOptions>(options =>
19+
{
20+
options.SignInAsAuthenticationType = CookieAuthenticationDefaults.AuthenticationType;
21+
});
22+
23+
});
24+
25+
app.UseCookieAuthentication(options =>
26+
{
27+
});
28+
29+
app.UseOpenIdConnectAuthentication(options =>
30+
{
31+
options.ClientId = "fe78e0b4-6fe7-47e6-812c-fb75cee266a4";
32+
options.Authority = "https://login.windows.net/cyrano.onmicrosoft.com";
33+
options.RedirectUri = "http://localhost:42023";
34+
});
35+
36+
app.Run(async context =>
37+
{
38+
if (context.User == null || !context.User.Identity.IsAuthenticated)
39+
{
40+
context.Response.Challenge(new AuthenticationProperties { RedirectUri = "/" }, OpenIdConnectAuthenticationDefaults.AuthenticationType);
41+
42+
context.Response.ContentType = "text/plain";
43+
await context.Response.WriteAsync("Hello First timer");
44+
return;
45+
}
46+
47+
context.Response.ContentType = "text/plain";
48+
await context.Response.WriteAsync("Hello Authenticated User");
49+
});
50+
51+
52+
}
53+
}
54+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"dependencies": {
3+
"Kestrel": "1.0.0-*",
4+
"Microsoft.AspNet.Security.Cookies": "1.0.0-*",
5+
"Microsoft.AspNet.Server.IIS": "1.0.0-*",
6+
"Microsoft.AspNet.Security.OpenIdConnect": "1.0.0-*",
7+
"Microsoft.AspNet.Server.WebListener": "1.0.0-*"
8+
},
9+
"frameworks": {
10+
"aspnet50": { },
11+
"aspnetcore50": { }
12+
},
13+
"commands": {
14+
"web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:12345",
15+
"kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5004"
16+
},
17+
"webroot": "wwwroot"
18+
}

src/Microsoft.AspNet.Security.Cookies/CookieAuthenticationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ protected override async Task ApplyResponseGrantAsync()
146146
{
147147
Domain = Options.CookieDomain,
148148
HttpOnly = Options.CookieHttpOnly,
149-
Path = Options.CookiePath ?? "/",
149+
Path = Options.CookiePath ?? (RequestPathBase.HasValue ? RequestPathBase.ToString() : "/"),
150150
};
151151
if (Options.CookieSecure == CookieSecureOption.SameAsRequest)
152152
{

src/Microsoft.AspNet.Security.Cookies/CookieAuthenticationOptions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public CookieAuthenticationOptions()
2424
{
2525
AuthenticationType = CookieAuthenticationDefaults.AuthenticationType;
2626
ReturnUrlParameter = CookieAuthenticationDefaults.ReturnUrlParameter;
27-
CookiePath = "/";
2827
ExpireTimeSpan = TimeSpan.FromDays(14);
2928
SlidingExpiration = true;
3029
CookieHttpOnly = true;

0 commit comments

Comments
 (0)