Skip to content

Commit 24743fb

Browse files
martincostellokevinchaletkYannforiequal0AnthonyYates
authored
Support ASP.NET 5.0 (#515)
* Update to ASP.NET 5 Updates to support ASP.NET 5, using preview 6. Remove obsolete members. * Update to ASP.NET 5 preview 7 Update to preview 5 of ASP.NET 5. * Update to ASP.NET 5 preview 8 Update to preview 8 of ASP.NET 5. * Align with AspNetCore previews Update the version metadata to align with ASP.NET Core, so we generate prerelease labels like "preview.8." or "rc.1.". * Update to ASP.NET 5 RC1 Update to RC1 of ASP.NET 5. * Use HashData() and ToHexString() methods Use new HashData() methods for SHA256 and MD5. Use Convert.ToHexString(). * Fix sign out in sample Fix sign out in the sample not working as it was overriding a method that is decorated with [NonAction]. * Use <DebugType>portable</DebugType> to avoid embedding the PDBs in the assemblies * Handle user cancelling LinkedIn sign in Handle the user cancelling login or denying permissions during LinkedIn sign in. Resolves #480. * Add Kloudless provider (#479) * WIP : Add kloudless provider * Add kloudless provider * Add entry in readme * Add commented example * Add more unit tests. Explicit error * Fix exception usage * Add missing punctuation * Add kloudless doc. Specify default scope and add possible scopes. * remove example in MVC project * Fix convention issue on constant. Add comment. * Update Kloudless provider to .NET 5 Updates to the Kloudless provider to support .NET 5. * Update to ASP.NET 5 RC2 Update to RC2 of ASP.NET 5. * Use IMemoryCache for Apple client secrets Use an IMemoryCache for Apple client secrets to support multiple keys in use at once for a mult-tenant application. Co-Authored-By: SeongChan Lee <[email protected]> * Add unit test for key caching Add a unit test to verify that keys are cached according to their options and vary according to different client/team/key Ids. * Use structured logging Use structured logging if client secret generation fails. * Remove JwtSecurityTokenHandler from DI Remove the configuration of JwtSecurityTokenHandler from the DI container and instead make it a property on AppleAuthenticationOptions. * Do not overlap with existing CryptoProviderFactory Rather than using an existing CryptoProviderFactory if one is registered with DI, which could potentially create a conflict between other usage and ours, explicitly use a custom implementation that ensures the cache is disabled. * Move JwtSecurityTokenHandler setup to post-configure Setup the JwtSecurityTokenHandler as a post-configure options implementation, rather than null-checking each time it's used. * Move Apple provider's services out of DI Move the services for the Apple provider out of DI and instead make them options on the AppleAuthenticationOptions class instead. * Remove ! Remove ! as it doesn't trigger a compiler error anymore since RC2. * Update staging subdomain for SuperOffice (#490) Co-authored-by: SuperOfficeDevNet <[email protected]> * Add email claim for Yahoo provider (#488) Email is a mandatory claim. Add it by default to claims. * Add email to Yahoo tests Add a test for the email claim for the Yahoo provider. Relates to #488. * Add KakaoTalk provider (#493) Add KakaoTalk provider and unit tests * Update KakaoTalk provider for .NET 5 Update the KakaoTalk provider to support .NET 5. * Use new syntax to set environment variable Use new syntax to set environment variable value. See https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable. * Use Write-Output Use Write-Output instead of Write-Host. * Use GITHUB_ENV not GITHUB_PATH That's what happens when the example of how to do one thing is in the section about how to do something else. * Update to ASP.NET 5 Update to the final release of ASP.NET 5. Update NuGet packages to their latest versions. * Bump version to 5.0.1 Bump version to 5.0.1 for next release. Revert prerelease label to preview. * Add UnionId claim for QQ provider (#509) * Add claim for 'UnionId' of QQ platform, and other optimizations for details * Update unittest&doc * Update unitest for UnionID * Fix doc & code style by suggestions of review * Use built-in SDK analyzers Use the code analyzers built into the .NET 5.0 SDK. * Use new ReadAs*() overloads Use new overloads for reading content which take a CancellationToken. * Add amoCRM provider (#507) * Add amoCRM provider * - Rename constants; - Change exception message; - Add test for surnamt claim type. * README change * Add amocrm.md * amoCRM required props description. * Add Lichess provider (#511) * Add Lichess Provider * Fixed indentation issue with documentation * Adding refresh token and accurate expires_in to bundle.json * Fixed PreferencesWrite scope name * Reverted to original Tests project definition * Fixed naming issue * Cleaned up code formatting issue * Updated documentation to reflect correct property type for Scope Co-authored-by: Martin Costello <[email protected]> * Renamed payloadEmail to emailPayload Co-authored-by: Martin Costello <[email protected]> * Comment casing typo corrected Co-authored-by: Martin Costello <[email protected]> * Changed comment regarding backchannel request Co-authored-by: Martin Costello <[email protected]> * Added Async to name of asynchronous method Co-authored-by: Martin Costello <[email protected]> * Code formatting fix Co-authored-by: Martin Costello <[email protected]> * Added nuget link to README * Renamed LichessAuthenticationConstants * Corrected one remaining CHANGEME reference * Fixed issues from renaming from suggestions * Fixed test reference Co-authored-by: Martin Costello <[email protected]> * Update amoCrm and Lichess providers to .NET 5 Update the amoCRM and Lichess providers to support .NET 5.0. * Add missing XML documentation For completeness, add missing XML documentation to the Lichess handler. * Fix parameter name Change "schema" to "scheme". * Stop using NuGet's Central Package Version Management feature * Add UnionId claim for QQ provider (#509) * Add claim for 'UnionId' of QQ platform, and other optimizations for details * Update unittest&doc * Update unitest for UnionID * Fix doc & code style by suggestions of review * Fix incorrect type Document the scopes as a collection, not a single string. * Update Pull Request template * Add note about package ownership for new providers. * Add note that creating issues for pull requests is optional. Co-authored-by: Kévin Chalet <[email protected]> Co-authored-by: Yann <[email protected]> Co-authored-by: SeongChan Lee <[email protected]> Co-authored-by: Anthony Yates <[email protected]> Co-authored-by: SuperOfficeDevNet <[email protected]> Co-authored-by: Faraj Farook <[email protected]> Co-authored-by: Donghyeon Kim <[email protected]> Co-authored-by: LeaFrock <[email protected]> Co-authored-by: Denis Ivanov <[email protected]> Co-authored-by: tanczosm <[email protected]>
1 parent 37adf0a commit 24743fb

File tree

162 files changed

+715
-572
lines changed

Some content is hidden

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

162 files changed

+715
-572
lines changed

AspNet.Security.OAuth.Providers.ruleset

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<RuleSet Name="AspNet.Security.OAuth.Providers Rules" Description="This rule set contains rules for the AspNet.Security.OAuth.Providers solution." ToolsVersion="16.0">
33
<IncludeAll Action="Warning" />
44
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
5+
<Rule Id="CA1014" Action="None" />
56
<Rule Id="CA1031" Action="None" />
67
<Rule Id="CA1034" Action="None" />
78
<Rule Id="CA1044" Action="None" />
@@ -13,6 +14,7 @@
1314
<Rule Id="CA1724" Action="None" />
1415
<Rule Id="CA1812" Action="None" />
1516
<Rule Id="CA2007" Action="None" />
17+
<Rule Id="CA2201" Action="None" />
1618
<Rule Id="CA2208" Action="None" />
1719
<Rule Id="CA2234" Action="None" />
1820
</Rules>

Directory.Build.props

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,11 @@
5757
</PropertyGroup>
5858

5959
<PropertyGroup>
60+
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
6061
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)AspNet.Security.OAuth.Providers.ruleset</CodeAnalysisRuleSet>
62+
<EnableNETAnalyzers>true</EnableNETAnalyzers>
6163
</PropertyGroup>
6264

63-
<ItemGroup>
64-
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" PrivateAssets="All" />
65-
</ItemGroup>
66-
6765
<ItemGroup>
6866
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
6967
<PackageReference Include="StyleCop.Analyzers" PrivateAssets="All" />

docs/sign-in-with-apple.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,15 @@ Below are links to a number of other documentation sources, blog posts and sampl
7777
| Property Name | Property Type | Description | Default Value |
7878
|:--|:--|:--|:--|
7979
| `ClientSecretExpiresAfter` | `TimeSpan` | The period of time after which generated client secrets expire if `GenerateClientSecret` is set to `true`. | 6 months |
80+
| `ClientSecretGenerator` | `AppleClientSecretGenerator` | A service that generates client secrets for Sign In with Apple. | _An internal implementation_ |
8081
| `GenerateClientSecret` | `bool` | Whether to automatically generate a client secret. | `false` |
82+
| `JwtSecurityTokenHandler` | `JwtSecurityTokenHandler` | The handler to use to validate JSON Web Keys. | `new JwtSecurityTokenHandler()` |
8183
| `KeyId` | `string?` | The optional ID for your Sign in with Apple private key. | `null` |
84+
| `KeyStore` | `AppleKeyStore` | A service that loads private keys to use with Sign In with Apple. | _An internal implementation_ |
8285
| `PublicKeyCacheLifetime` | `TimeSpan` | The default period of time to cache Apple public key(s) for. | `TimeSpan.FromMinutes(15)` |
8386
| `PublicKeyEndpoint` | `string` | The URI to use to retrieve the Apple public keys. | `AppleAuthenticationDefaults.PublicKeyEndpoint` |
8487
| `PrivateKeyBytes` | `Func<string, Task<byte[]>>?` | An optional delegate to use to get the raw bytes of the client's private key in PKCS #8 format. | `null` |
8588
| `TeamId` | `string` | The Team ID for your Apple Developer account. | `""` |
8689
| `TokenAudience` | `string` | The audience used for tokens. | `AppleAuthenticationConstants.Audience` |
90+
| `TokenValidator` | `AppleIdTokenValidator` | A service that validates Apple ID tokens. | `An internal implementation` |
8791
| `ValidateTokens` | `bool` | Whether to validate tokens using Apple's public key. | `true` |

eng/Versions.props

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
<Project>
22

33
<PropertyGroup>
4-
<MajorVersion>3</MajorVersion>
5-
<MinorVersion>1</MinorVersion>
6-
<PatchVersion>7</PatchVersion>
4+
<MajorVersion>5</MajorVersion>
5+
<MinorVersion>0</MinorVersion>
6+
<PatchVersion>1</PatchVersion>
77
<VersionPrefix>$(MajorVersion).$(MinorVersion).$(PatchVersion)</VersionPrefix>
88
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
9+
<PreReleaseVersionIteration></PreReleaseVersionIteration>
10+
<PreReleaseBrandingLabel>Preview $(PreReleaseVersionIteration)</PreReleaseBrandingLabel>
911
<StabilizePackageVersion Condition="'$(StabilizePackageVersion)' == ''">false</StabilizePackageVersion>
1012
<DotNetFinalVersionKind Condition="'$(StabilizePackageVersion)' == 'true'">release</DotNetFinalVersionKind>
13+
<IncludePreReleaseLabelInPackageVersion>true</IncludePreReleaseLabelInPackageVersion>
14+
<IncludePreReleaseLabelInPackageVersion Condition=" '$(DotNetFinalVersionKind)' == 'release' ">false</IncludePreReleaseLabelInPackageVersion>
1115
</PropertyGroup>
1216

1317
</Project>

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"tools": {
3-
"dotnet": "3.1.401"
3+
"dotnet": "5.0.100"
44
},
55

66
"msbuild-sdks": {

samples/Mvc.Client/Controllers/AuthenticationController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public async Task<IActionResult> SignIn([FromForm] string provider)
4040

4141
[HttpGet("~/signout")]
4242
[HttpPost("~/signout")]
43-
public IActionResult SignOut()
43+
public IActionResult SignOutCurrentUser()
4444
{
4545
// Instruct the cookies middleware to delete the local cookie created
4646
// when the user agent is redirected from the external identity provider

samples/Mvc.Client/Mvc.Client.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
4+
<TargetFrameworks>net5.0</TargetFrameworks>
55
<UserSecretsId>AspNet.Security.OAuth.Providers.Mvc.Client</UserSecretsId>
66
</PropertyGroup>
77

src/AspNet.Security.OAuth.Amazon/AmazonAuthenticationHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ protected override async Task<AuthenticationTicket> CreateTicketAsync(
6464
"returned a {Status} response with the following payload: {Headers} {Body}.",
6565
/* Status: */ response.StatusCode,
6666
/* Headers: */ response.Headers.ToString(),
67-
/* Body: */ await response.Content.ReadAsStringAsync());
67+
/* Body: */ await response.Content.ReadAsStringAsync(Context.RequestAborted));
6868

6969
throw new HttpRequestException("An error occurred while retrieving the user profile from Amazon.");
7070
}
7171

72-
using var payload = JsonDocument.Parse(await response.Content.ReadAsStringAsync());
72+
using var payload = JsonDocument.Parse(await response.Content.ReadAsStringAsync(Context.RequestAborted));
7373

7474
var principal = new ClaimsPrincipal(identity);
7575
var context = new OAuthCreatingTicketContext(principal, properties, Context, Scheme, Options, Backchannel, tokens, payload.RootElement);
7676
context.RunClaimActions();
7777

7878
await Options.Events.CreatingTicket(context);
79-
return new AuthenticationTicket(context.Principal, context.Properties, Scheme.Name);
79+
return new AuthenticationTicket(context.Principal!, context.Properties, Scheme.Name);
8080
}
8181
}
8282
}

src/AspNet.Security.OAuth.Amazon/AspNet.Security.OAuth.Amazon.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
4+
<TargetFrameworks>net5.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<PropertyGroup>

src/AspNet.Security.OAuth.AmoCrm/AmoCrmAuthenticationExtensions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,33 @@ public static AuthenticationBuilder AddAmoCrm(
4747
/// <see cref="ApplicationBuilder"/>, which enables amoCRM authentication capabilities.
4848
/// </summary>
4949
/// <param name="builder">The authentication builder.</param>
50-
/// <param name="schema">The authentication scheme associated with this instance.</param>
50+
/// <param name="scheme">The authentication scheme associated with this instance.</param>
5151
/// <param name="configuration">The delegate used to configure the amoCRM options.</param>
5252
/// <returns>The <see cref="AuthenticationBuilder"/>.</returns>
5353
public static AuthenticationBuilder AddAmoCrm(
5454
[NotNull] this AuthenticationBuilder builder,
55-
[NotNull] string schema,
55+
[NotNull] string scheme,
5656
[NotNull] Action<AmoCrmAuthenticationOptions> configuration)
5757
{
58-
return builder.AddAmoCrm(schema, AmoCrmAuthenticationDefaults.DisplayName, configuration);
58+
return builder.AddAmoCrm(scheme, AmoCrmAuthenticationDefaults.DisplayName, configuration);
5959
}
6060

6161
/// <summary>
6262
/// Adds <see cref="AmoCrmAuthenticationHandler"/> to the specified
6363
/// <see cref="ApplicationBuilder"/>, which enables amoCRM authentication capabilities.
6464
/// </summary>
6565
/// <param name="builder">The authentication builder.</param>
66-
/// <param name="schema">The authentication scheme associated with this instance.</param>
66+
/// <param name="scheme">The authentication scheme associated with this instance.</param>
6767
/// <param name="caption">The optional display name associated with this instance.</param>
6868
/// <param name="configuration">The delegate used to configure the amoCRM options.</param>
6969
/// <returns>The <see cref="AuthenticationBuilder"/>.</returns>
7070
public static AuthenticationBuilder AddAmoCrm(
7171
[NotNull] this AuthenticationBuilder builder,
72-
[NotNull] string schema,
72+
[NotNull] string scheme,
7373
[NotNull] string caption,
7474
[NotNull] Action<AmoCrmAuthenticationOptions> configuration)
7575
{
76-
return builder.AddOAuth<AmoCrmAuthenticationOptions, AmoCrmAuthenticationHandler>(schema, caption, configuration);
76+
return builder.AddOAuth<AmoCrmAuthenticationOptions, AmoCrmAuthenticationHandler>(scheme, caption, configuration);
7777
}
7878
}
7979
}

0 commit comments

Comments
 (0)