Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update to ASP.NET Core 3.0 preview 9
Update to preview 9 of ASP.NET Core 3.0.
  • Loading branch information
martincostello committed Sep 14, 2019
commit e7dc2e64d0e47597be5ce7fe947a520950689a96
5 changes: 4 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<Product>aspnet-contrib</Product>
<Company>$(Authors)</Company>
<_ProjectCopyright>© AspNet.Security.OAuth.Providers contributors. All rights reserved.</_ProjectCopyright>
<PackageIconUrl>https://avatars3.githubusercontent.com/u/7998081?s=64</PackageIconUrl>
<PackageIcon>package-icon.png</PackageIcon>
<PackageProjectUrl>https://github.com/aspnet-contrib/AspNet.Security.OpenId.Providers</PackageProjectUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
Expand All @@ -47,6 +47,9 @@
<IsPackable>true</IsPackable>
<IsShipping>true</IsShipping>
</PropertyGroup>
<ItemGroup Condition=" '$(IsPackable)' == 'true' ">
<None Include="$(MSBuildThisFileDirectory)\package-icon.png" Pack="True" PackagePath="" />
</ItemGroup>
<ItemGroup Condition=" '$(OS)' != 'Windows_NT' ">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0-preview.2" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project>
<PropertyGroup>
<VersionPrefix>2.1.1</VersionPrefix>
<PreReleaseVersionLabel>alpha1</PreReleaseVersionLabel>
<PreReleaseVersionLabel>preview9</PreReleaseVersionLabel>
</PropertyGroup>
<PropertyGroup>
<AngleSharpVersion>0.9.9</AngleSharpVersion>
<AspNetCoreVersion>2.0.0</AspNetCoreVersion>
<AspNetCoreVersion>3.0.0-preview9.19424.4</AspNetCoreVersion>
<IdentityModelCoreVersion>2.1.4</IdentityModelCoreVersion>
<JetBrainsVersion>2019.1.1</JetBrainsVersion>
<JetBrainsVersion>2019.1.3</JetBrainsVersion>
<JsonNetVersion>10.0.3</JsonNetVersion>
<JustEatHttpClientInterceptionVersion>2.0.2</JustEatHttpClientInterceptionVersion>
<MartinCostelloLoggingXUnitVersion>0.1.0</MartinCostelloLoggingXUnitVersion>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"tools": {
"dotnet": "2.2.401"
"dotnet": "3.0.100-preview9-014004"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19405.1",
Expand Down
Binary file added package-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions samples/Mvc.Client/Mvc.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\AspNet.Security.OpenId.Steam\AspNet.Security.OpenId.Steam.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

</Project>
15 changes: 7 additions & 8 deletions samples/Mvc.Client/Program.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

namespace Mvc.Client
{
public static class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
=> CreateHostBuilder(args).Build().Run();

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(
(webBuilder) => webBuilder.UseStartup<Startup>());
}
}
10 changes: 8 additions & 2 deletions samples/Mvc.Client/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,22 @@ public void ConfigureServices(IServiceCollection services)

.AddSteam();

services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
}

public void Configure(IApplicationBuilder app)
{
app.UseStaticFiles();

app.UseRouting();

app.UseAuthentication();
app.UseAuthorization();

app.UseMvc();
app.UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute();
});
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -15,6 +15,7 @@
</ItemGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="JetBrains.Annotations" Version="$(JetBrainsVersion)" PrivateAssets="All" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/AspNet.Security.OpenId/AspNet.Security.OpenId.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -11,9 +11,9 @@
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="AngleSharp" Version="$(AngleSharpVersion)" />
<PackageReference Include="JetBrains.Annotations" Version="$(JetBrainsVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.IdentityModel.Protocols" Version="$(IdentityModelCoreVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(JsonNetVersion)" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AspNetCoreVersion>2.2.0</AspNetCoreVersion>
<RootNamespace>AspNet.Security.OpenId</RootNamespace>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
Expand All @@ -13,7 +12,7 @@
<ProjectReference Include="..\..\src\**\*.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="JustEat.HttpClientInterception" Version="$(JustEatHttpClientInterceptionVersion)" />
<PackageReference Include="MartinCostello.Logging.XUnit" Version="$(MartinCostelloLoggingXUnitVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(AspNetCoreVersion)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,31 @@ private static void ConfigureApplication(IApplicationBuilder app)
{
// Configure a single HTTP resource that challenges the client if unauthenticated
// or returns the logged in user's claims as XML if the request is authenticated.
app.UseAuthentication();

app.Map("/me", childApp => childApp.Run(
async context =>
{
if (context.User.Identity.IsAuthenticated)
{
string xml = IdentityToXmlString(context.User);
byte[] buffer = Encoding.UTF8.GetBytes(xml.ToString());

context.Response.StatusCode = 200;
context.Response.ContentType = "text/xml";

await context.Response.Body.WriteAsync(buffer, 0, buffer.Length);
}
else
{
await context.ChallengeAsync();
}
}));
app.UseRouting();

app.UseAuthentication()
.UseEndpoints(endpoints =>
{
endpoints.MapGet(
"/me",
async context =>
{
if (context.User.Identity.IsAuthenticated)
{
var xml = IdentityToXmlString(context.User);
var buffer = Encoding.UTF8.GetBytes(xml.ToString());

context.Response.StatusCode = 200;
context.Response.ContentType = "text/xml";

await context.Response.Body.WriteAsync(buffer, 0, buffer.Length);
}
else
{
await context.ChallengeAsync();
}
});
});
}

private static string IdentityToXmlString(ClaimsPrincipal user)
Expand Down