Skip to content

Commit a865eed

Browse files
Support ASP.NET Core 3.0 (#348)
* Update providers to ASP.NET Core 3.0 Update all providers to ASP.NET Core 3.0, using preview 6. * Remove KoreBuild Remove usage of KoreBuild as it is obsolete and no longer supports .NET Core 3.0 after preview 5. Add code coverage to test project. * Add shopify provider (#326) * Add shopify provider * Revert sln changes * Apply code review * Fix second core review * Fix ChallentAsync param comment * Fix scope summary * Done pull request review #3 * Revert whitespace * Update ShopifyLoopbackRedirectHandler.cs * Update ShopifyAuthenticationExtensions.cs * Update ShopifyAuthenticationHandler.cs * Update ShopifyAuthenticationOptions.cs * Update ShopifyTests.cs * Update README.md * Update README.md * Update coverlet and ReportGenerator Update to the latest releases of coverlet and ReportGenerator for code coverage metrics. * Shopify - Fix TokenEndpoint format (#330) Fix TokenEndpoint format * Gitlab (#329) * Added gitlab oauth * Fixed some minor typos & restored wildcard include * Applied suggested changes from code review * Added missing version var to tests * Added missing release build config * Added Gitlab back to solution * Fix VS auto resolving the references * Revert weird bundle exclude * Update GitLab for ASP.NET Core 3.0 Update the GitLab provider to support ASP.NET Core 3.0. * Update to ASP.NET Core 3.0 preview 7 Update to preview 7 of ASP.NET Core 3.0. Update NuGet packages to latest versions. Fix code coverage output path. Remove premature disposal in the Zalo provider. * Use latest macOS image Use the latest macOS image. * Add UseAuthorization() Add UseAuthorization() to the README for ASP.NET Core 3.0. * Update to ASP.NET Core 3.0 preview 8 Update to preview 8 of ASP.NET Core 3.0. * Update dependencies Update NuGet packages to their latest versions. * Use Arcade for build (#335) * Use Arcade for build Switch to Arcade to build the project Addresses #321. * Update LICENSE Fix Arcade error from non-compliant license text. * Add +x to scripts * Update appveyor.yml Update packages location. Update version. Disable PR publish. Disabe test discovery. * Move eng to solution items Move the eng folder in the solution to be under Solution Items. * Use newer test SDK Use the latest stable version of the test SDK. * Add files for Visual Studio Code Add assets to build and run tests in Visual Studio Code. * Generate AppVeyor build numbers Generate Arcade "official build Ids" in AppVeyor * Update appveyor.yml Collect test results and upload to AppVeyor. * Update to ASP.NET Core 3.0 preview 9 Update to preview 9 of ASP.NET Core 3.0. * Remove PackageIconUrl Use PackageIcon instead of PackageIconUrl as described by https://github.com/NuGet/Home/wiki/Packaging-Icon-within-the-nupkg as it is considered obsolete. * Update .gitignore Ignore .coverage files from Visual Studio code coverage. * Merge from dev (#339) * Add shopify provider (#326) * Add shopify provider * Revert sln changes * Apply code review * Fix second core review * Fix ChallentAsync param comment * Fix scope summary * Done pull request review #3 * Revert whitespace * Update ShopifyLoopbackRedirectHandler.cs * Update ShopifyAuthenticationExtensions.cs * Update ShopifyAuthenticationHandler.cs * Update ShopifyAuthenticationOptions.cs * Update ShopifyTests.cs * Update README.md * Update README.md * Shopify - Fix TokenEndpoint format (#330) Fix TokenEndpoint format * Gitlab (#329) * Added gitlab oauth * Fixed some minor typos & restored wildcard include * Applied suggested changes from code review * Added missing version var to tests * Added missing release build config * Added Gitlab back to solution * Fix VS auto resolving the references * Revert weird bundle exclude * incorrect LoginPath In this startup file, it previously said "login", but in AuthenticationController the route is defined as "signin" * Add MyGet publish step Add step to publish packages to MyGet again. * Change prerelease label Change the prerelease label to preview 9. * Fix assembly copyrights Apply fix to assembly copyright as-per openiddict/openiddict-core#797. * Update to ASP.NET Core 3.0 RC1 Update to release candidate 1 of ASP.NET Core 3.0. * Add Sign in with Apple provider (#343) * Add shopify provider (#326) * Add shopify provider * Revert sln changes * Apply code review * Fix second core review * Fix ChallentAsync param comment * Fix scope summary * Done pull request review #3 * Revert whitespace * Update ShopifyLoopbackRedirectHandler.cs * Update ShopifyAuthenticationExtensions.cs * Update ShopifyAuthenticationHandler.cs * Update ShopifyAuthenticationOptions.cs * Update ShopifyTests.cs * Update README.md * Update README.md * Shopify - Fix TokenEndpoint format (#330) Fix TokenEndpoint format * Gitlab (#329) * Added gitlab oauth * Fixed some minor typos & restored wildcard include * Applied suggested changes from code review * Added missing version var to tests * Added missing release build config * Added Gitlab back to solution * Fix VS auto resolving the references * Revert weird bundle exclude * incorrect LoginPath In this startup file, it previously said "login", but in AuthenticationController the route is defined as "signin" * Basic Apple provider Add a very basic Sign In with Apple provider based on currently available information. * Implement Apple provider Fully implement the provider for Sign In with Apple based on current available functionality. * Enable Sign In with Apple Enable Sign In with Apple in the MVC sample app without hard-coding secrets. * Update tests Update the tests for the updated provider implementation. Fix incorrect test method name. * Enable token lifetime validation Enable the validation of token lifetimes. * Add null annotations Add [NotNull] attributes to relevant methods. * Improve exception handling Pre-validate the ID token has a value. Change catch clause to improve logging. * Extend integration tests Extend the integration tests for additional scenarios such as no validation, invalid tokens and using a configured client secret. * Move expiry period to options Move the configured lifetime for generated client secrets to the options class. * Add ClientSecretExpiresAfter validation Add validation for the value of ClientSecretExpiresAfter. * Add tests for options validation Add unit tests for options validation. Improve exception type. Fix incorrect if condition that meant not all values were validated correctly. * Add unit tests for client secret Add unit tests for the generated client secret's format. * Make KeyId required Make the KeyId option required if GenerateClientSecret is true. * Fix test Fix the expiry not being set. * Fix Linux and macOS secret generation Work around platform differences between Windows and Linux/macOS by supporting .p12/.pfx certificates for Linux/macOS and using p8 for Windows. .NET Core 3.0 adds support for .p8 on both platforms. * Add password option for pfx files Add an option for specifying a password for PFX files. Add a test private key that has a password for use on macOS. * Fix flaky test Fix flaky test by setting the expiry to 2 seconds to eliminate rounding issues. * Add UsePrivateKey() method Add UsePrivateKey() extension method that configures a private key file to use to auto-generate client secrets. * Bump System.IdentityModel.Tokens.Jwt Bump System.IdentityModel.Tokens.Jwt to 5.3.0 to ensure that incompatibility with .NET Standard 1.4 doesn't affect consumers. * Set response_mode to form_post React to changes Apple have made to the sign-in service, and use form_post as the response mode. This requires reimplementing HandleRemoteAuthenticateAsync() by using either for Form or Query based on whether it is an HTTP POST. * Use latest C# version Fix the build by enabling the latest version of C#. * Retrieve user details after sign-in Get the user's name and email address, if available, as claims after signing in with an Apple ID. These details are only available the first time the user signs in; if they are not persisted they cannot currently be obtained again. * Update branding Use "Sign in with Apple" instead of "Sign In with Apple". * Access events via options Use the same approach as the other OAuth handlers and access the Events property via the Options property. * Resolve logging TODO Remove TODO comment. Check whether Trace logging is enabled before logging the Apple token response. * Comment out Apple option Comment out the Apple provider as it causes the application to fail to start if the values aren't set and/or the key file does not exist. * Update Sign in with Apple provider for ASP.NET Core 3.0 Update the Sign in with Apple provider to support ASP.NET Core 3.0. Update the .NET Core test SDK version. Fix-up Startup warnings. * Add Nextcloud provider (#325) * Add Nextcloud provider and unit test * updated according to suggestions * Change ClaimTypes.Name to Claims.Username * Update Nextcloud for ASP.NET Core 3.0 Update the Nextcloud provider to support ASP.NET Core 3.0. * Add missing usings Add missing usings to request and response in GitLab handler. * Use LangVersion latest Stop using preview versions of C# now that C# 8 is the default for the .NET Core 3.0 SDK. * Update to ASP.NET Core 3.0 Update to ASP.NET Core 3.0 final packages and SDK. * Remove additional NuGet feeds Remove extra NuGet feeds not needed now 3.0.0 packages are in NuGet.org. * Add authorization Add authorization middleware.
1 parent 38a0128 commit a865eed

File tree

286 files changed

+10961
-2046
lines changed

Some content is hidden

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

286 files changed

+10961
-2046
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Ignore Visual Studio temporary files, build results, and
1+
## Ignore Visual Studio temporary files, build results, and
22
## files generated by popular Visual Studio add-ons.
33

44
# VS 14 temporary folder
@@ -16,7 +16,11 @@ project.lock.json
1616

1717
# Build results
1818

19+
.dotnet/
20+
.dotnetcli/
1921
artifacts/
22+
coverage/
23+
coverage.*
2024
[Dd]ebug/
2125
[Rr]elease/
2226
x64/
@@ -29,6 +33,7 @@ x64/
2933
# MSTest test Results
3034
[Tt]est[Rr]esult*/
3135
[Bb]uild[Ll]og.*
36+
*.coverage
3237

3338
*_i.c
3439
*_p.c

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ env:
1818
os:
1919
- linux
2020
- osx
21-
osx_image: xcode8.3
2221
script:
23-
- ./build.sh
22+
- ./eng/common/cibuild.sh -configuration Release -prepareMachine

.vscode/launch.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Run tests",
6+
"type": "coreclr",
7+
"request": "launch",
8+
"preLaunchTask": "build",
9+
"program": "dotnet",
10+
"args": [
11+
"test"
12+
],
13+
"cwd": "${workspaceFolder}/test/AspNet.Security.OAuth.Providers.Tests",
14+
"console": "internalConsole",
15+
"stopAtEntry": false
16+
}
17+
]
18+
}

.vscode/tasks.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/test/AspNet.Security.OAuth.Providers.Tests/AspNet.Security.OAuth.Providers.Tests.csproj",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "watch",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"watch",
22+
"run",
23+
"${workspaceFolder}/test/AspNet.Security.OAuth.Providers.Tests/AspNet.Security.OAuth.Providers.Tests.csproj",
24+
"/property:GenerateFullPaths=true",
25+
"/consoleloggerparameters:NoSummary"
26+
],
27+
"problemMatcher": "$msCompile"
28+
}
29+
]
30+
}

AspNet.Security.OAuth.Providers.sln

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.28803.156
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{8DCAEA78-86AE-4183-93C0-41C7F8850AAA}"
7-
ProjectSection(SolutionItems) = preProject
8-
build\common.props = build\common.props
9-
build\dependencies.props = build\dependencies.props
10-
build\key.snk = build\key.snk
11-
build\packages.props = build\packages.props
12-
build\version.props = build\version.props
13-
EndProjectSection
14-
EndProject
156
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}"
167
EndProject
178
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{BAC7067D-88FE-4385-8AC9-1A325FFBDE69}"
@@ -122,19 +113,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
122113
.gitattributes = .gitattributes
123114
.gitignore = .gitignore
124115
.travis.yml = .travis.yml
116+
appveyor.yml = appveyor.yml
125117
build.cmd = build.cmd
126118
build.ps1 = build.ps1
127119
build.sh = build.sh
128120
CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md
121+
Directory.Build.props = Directory.Build.props
122+
Directory.Build.targets = Directory.Build.targets
129123
global.json = global.json
130-
korebuild-lock.txt = korebuild-lock.txt
131-
korebuild.json = korebuild.json
132124
LICENSE = LICENSE
133125
NuGet.config = NuGet.config
134126
README.md = README.md
135-
run.cmd = run.cmd
136-
run.ps1 = run.ps1
137-
run.sh = run.sh
138127
EndProjectSection
139128
EndProject
140129
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{3FA3F7B5-5373-4E43-8F45-8EC18249E526}"
@@ -167,6 +156,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mvc.Client", "samples\Mvc.C
167156
EndProject
168157
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.Security.OAuth.GitLab", "src\AspNet.Security.OAuth.GitLab\AspNet.Security.OAuth.GitLab.csproj", "{FACB1C2F-3BF7-4DD3-958B-E471E69E214A}"
169158
EndProject
159+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "eng", "eng", "{5D188043-25D9-4110-BAFA-7C47E6E0DDB6}"
160+
ProjectSection(SolutionItems) = preProject
161+
eng\Signing.props = eng\Signing.props
162+
eng\Version.Details.xml = eng\Version.Details.xml
163+
eng\Versions.props = eng\Versions.props
164+
EndProjectSection
165+
EndProject
166+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".vscode", ".vscode", "{ED9006DA-AF38-4629-97F2-DE54395A8A9C}"
167+
ProjectSection(SolutionItems) = preProject
168+
.vscode\launch.json = .vscode\launch.json
169+
.vscode\tasks.json = .vscode\tasks.json
170+
EndProjectSection
171+
EndProject
170172
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.Security.OAuth.Apple", "src\AspNet.Security.OAuth.Apple\AspNet.Security.OAuth.Apple.csproj", "{DC80AFEC-EFB4-4B21-BF79-44DEA6E1FE26}"
171173
EndProject
172174
Global
@@ -471,6 +473,8 @@ Global
471473
{112F6B50-0FD3-45AA-992E-72D7B873BF00} = {C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}
472474
{140A6CAD-FC84-4A09-A939-8A5692DF0C7C} = {BAC7067D-88FE-4385-8AC9-1A325FFBDE69}
473475
{FACB1C2F-3BF7-4DD3-958B-E471E69E214A} = {C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}
476+
{5D188043-25D9-4110-BAFA-7C47E6E0DDB6} = {E9DAB098-A902-4EF5-9AEE-CF735DF31E35}
477+
{ED9006DA-AF38-4629-97F2-DE54395A8A9C} = {E9DAB098-A902-4EF5-9AEE-CF735DF31E35}
474478
{DC80AFEC-EFB4-4B21-BF79-44DEA6E1FE26} = {C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}
475479
EndGlobalSection
476480
GlobalSection(ExtensibilityGlobals) = postSolution

Directory.Build.props

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<Project>
2+
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
3+
<PropertyGroup>
4+
<LangVersion>latest</LangVersion>
5+
<NoWarn>$(NoWarn);CS1591</NoWarn>
6+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
7+
<DebugSymbols>true</DebugSymbols>
8+
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)\eng\key.snk</AssemblyOriginatorKeyFile>
9+
<SignAssembly>true</SignAssembly>
10+
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
11+
</PropertyGroup>
12+
<!--
13+
Arcade only allows the revision to contain up to two characters, and AppVeyor does not roll-over
14+
build numbers every day like Azure DevOps does. To balance these two requirements, set the official
15+
build ID to be the same format as the built-in default from Arcade, except with the revision number
16+
being the number of the quarter hour of the current time of day (24 * 4 = 96, which is less than 100).
17+
So a build between 00:00 and 00:14 would have a revision of 1, and a build between 23:45 and 23:59:59
18+
would have a revision of 97.
19+
-->
20+
<PropertyGroup Condition=" '$(APPVEYOR)' == 'True' AND '$(APPVEYOR_PULL_REQUEST_NUMBER)' == '' ">
21+
<_Hours>$([MSBuild]::Multiply($([System.DateTime]::Now.ToString(HH)), 4))</_Hours>
22+
<_QuarterHours>$([MSBuild]::Divide($([System.DateTime]::Now.ToString(mm)), 15))</_QuarterHours>
23+
<_QuarterHours>$([System.Math]::Floor($(_QuarterHours)))</_QuarterHours>
24+
<_AppVeyorBuildRevision>$([MSBuild]::Add($(_Hours), $(_QuarterHours)))</_AppVeyorBuildRevision>
25+
<_AppVeyorBuildRevision>$([MSBuild]::Add($(_AppVeyorBuildRevision), 1))</_AppVeyorBuildRevision>
26+
<OfficialBuild>true</OfficialBuild>
27+
<OfficialBuildId Condition=" '$(OfficialBuild)' == 'true' ">$([System.DateTime]::Now.ToString(yyyyMMdd)).$(_AppVeyorBuildRevision)</OfficialBuildId>
28+
</PropertyGroup>
29+
<PropertyGroup>
30+
<Product>aspnet-contrib</Product>
31+
<Company>$(Authors)</Company>
32+
<_ProjectCopyright>© AspNet.Security.OAuth.Providers contributors. All rights reserved.</_ProjectCopyright>
33+
<PackageIcon>package-icon.png</PackageIcon>
34+
<PackageProjectUrl>https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers</PackageProjectUrl>
35+
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
36+
<RepositoryType>git</RepositoryType>
37+
<RepositoryUrl>git://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers</RepositoryUrl>
38+
</PropertyGroup>
39+
<PropertyGroup>
40+
<RepoRelativeProjectDir>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory)))</RepoRelativeProjectDir>
41+
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
42+
</PropertyGroup>
43+
<PropertyGroup Condition=" $(RepoRelativeProjectDir.Contains('src')) ">
44+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
45+
<IncludeSource>true</IncludeSource>
46+
<IncludeSymbols>true</IncludeSymbols>
47+
<IsPackable>true</IsPackable>
48+
<IsShipping>true</IsShipping>
49+
</PropertyGroup>
50+
<ItemGroup Condition=" '$(IsPackable)' == 'true' ">
51+
<None Include="$(MSBuildThisFileDirectory)package-icon.png" Pack="True" PackagePath="" />
52+
</ItemGroup>
53+
<ItemGroup Condition=" '$(OS)' != 'Windows_NT' ">
54+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0-preview.2" />
55+
</ItemGroup>
56+
<ItemGroup>
57+
<ProjectCapability Include="DynamicDependentFile" />
58+
<ProjectCapability Include="DynamicFileNesting" />
59+
</ItemGroup>
60+
</Project>

Directory.Build.targets

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project>
2+
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
3+
4+
<!--
5+
Note: Arcade automatically replaces copyrights defined in .props or .csproj files
6+
with the default Microsoft copyright. To ensure this doesn't happen, the replaced
7+
copyright is restored in this .targets file using the private variable set in .props.
8+
-->
9+
10+
<PropertyGroup>
11+
<Copyright>$(_ProjectCopyright)</Copyright>
12+
</PropertyGroup>
13+
14+
</Project>

LICENSE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
Apache License
23
Version 2.0, January 2004
34
http://www.apache.org/licenses/
@@ -186,7 +187,7 @@
186187
same "printed page" as the copyright notice for easier
187188
identification within third-party archives.
188189

189-
Copyright 2015 https://github.com/aspnet-contrib
190+
Copyright [yyyy] [name of copyright owner]
190191

191192
Licensed under the Apache License, Version 2.0 (the "License");
192193
you may not use this file except in compliance with the License.

NuGet.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
<configuration>
33
<packageSources>
44
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
5+
<add key="arcade" value="https://dotnetfeed.blob.core.windows.net/dotnet-tools-internal/index.json" />
6+
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
7+
<add key="azureadwebstacknightly" value="https://www.myget.org/F/azureadwebstacknightly/api/v3/index.json" />
58
</packageSources>
69
</configuration>

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public void ConfigureServices(IServiceCollection services)
2727
public void Configure(IApplicationBuilder app)
2828
{
2929
app.UseAuthentication();
30+
app.UseAuthorization();
3031
}
3132
```
3233

0 commit comments

Comments
 (0)