Skip to content

Commit

Permalink
Merge branch 'master' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikprijck committed Dec 5, 2023
2 parents 1a21f5a + bb4b1da commit 217a8e6
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 52 deletions.
4 changes: 2 additions & 2 deletions nuget/Auth0.OidcClient.WPF.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@
<dependencies>
<group targetFramework="net462">
<dependency id="Auth0.OidcClient.Core" version="3.4.1" />
<dependency id="Microsoft.Toolkit.Wpf.UI.Controls.WebView" version="6.1.1"/>
<dependency id="Microsoft.Web.WebView2" version="1.0.1823.32"/>
</group>
<group targetFramework="netcoreapp3.1">
<dependency id="Auth0.OidcClient.Core" version="3.4.1" />
<dependency id="Microsoft.Toolkit.Wpf.UI.Controls.WebView" version="6.1.1"/>
<dependency id="Microsoft.Web.WebView2" version="1.0.1823.32"/>
</group>
<group targetFramework="net6.0-windows7.0">
<dependency id="Auth0.OidcClient.Core" version="3.4.1" />
Expand Down
4 changes: 2 additions & 2 deletions nuget/Auth0.OidcClient.WinForms.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@
<dependencies>
<group targetFramework="net462">
<dependency id="Auth0.OidcClient.Core" version="3.4.1" />
<dependency id="Microsoft.Toolkit.Forms.UI.Controls.WebView" version="6.1.1"/>
<dependency id="Microsoft.Web.WebView2" version="1.0.1823.32"/>
</group>
<group targetFramework="netcoreapp3.1">
<dependency id="Auth0.OidcClient.Core" version="3.4.1" />
<dependency id="Microsoft.Toolkit.Forms.UI.Controls.WebView" version="6.1.1"/>
<dependency id="Microsoft.Web.WebView2" version="1.0.1823.32"/>
</group>
<group targetFramework="net6.0-windows7.0">
<dependency id="Auth0.OidcClient.Core" version="3.4.1" />
Expand Down
5 changes: 0 additions & 5 deletions src/Auth0.OidcClient.Core/Auth0ClientBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ private OidcClientOptions CreateOidcClientOptions(Auth0ClientOptions options)
}
};

#pragma warning disable CS0618 // ClientSecret will be removed in a future update.
if (!String.IsNullOrWhiteSpace(oidcClientOptions.ClientSecret))
oidcClientOptions.ClientSecret = options.ClientSecret;
#pragma warning restore CS0618

if (options.RefreshTokenMessageHandler != null)
oidcClientOptions.RefreshTokenInnerHttpHandler = options.RefreshTokenMessageHandler;

Expand Down
7 changes: 0 additions & 7 deletions src/Auth0.OidcClient.Core/Auth0ClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ public class Auth0ClientOptions
/// </summary>
public string ClientId { get; set; }

/// <summary>
/// Your Auth0 Client Secret.
/// </summary>
[Obsolete("Client Secrets should not be used in non-confidential clients such as native desktop and mobile apps. " +
"This property will be removed in a future release.")]
public string ClientSecret { get; set; }

/// <summary>
/// Your Auth0 tenant domain.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Auth0.OidcClient.Core/Tokens/IdTokenValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ internal async Task AssertTokenMeetsRequirements(IdTokenRequirements required, s

var token = DecodeToken(rawIDToken);

// For now we want to support HS256 + ClientSecret as we just had a major release.
// TODO: In the next major (v4.0) we should remove this condition as well as Auth0ClientOptions.ClientSecret
// Signature Verification is optional because the token endpoint is over HTTPS.
// As we allow HS256 signed Id token, but we do not have a Client Secret we skip signature verification for HS256.
if (token.SignatureAlgorithm != "HS256")
(signatureVerifier ?? await assymetricSignatureVerifier.ForJwks(required.Issuer)).VerifySignature(rawIDToken);

Expand Down
4 changes: 1 addition & 3 deletions src/Auth0.OidcClient.WPF/Auth0.OidcClient.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
<When Condition="'$(TargetFramework)'!='net6.0-windows'">
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Toolkit.Wpf.UI.Controls.WebView">
<Version>6.1.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1823.32" />
</ItemGroup>
</When>
<When Condition="'$(TargetFramework)'=='net6.0-windows'">
Expand Down
16 changes: 2 additions & 14 deletions src/Auth0.OidcClient.WPF/WebViewBrowser.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using IdentityModel.OidcClient.Browser;
#if NET6_0
using WebViewCompatible = Microsoft.Web.WebView2.Wpf.WebView2;
#else
using Microsoft.Toolkit.Wpf.UI.Controls;
#endif
using Microsoft.Web.WebView2.Wpf;
using System;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -54,16 +50,12 @@ public async Task<BrowserResult> InvokeAsync(BrowserOptions options, Cancellatio

var window = _windowFactory();
#pragma warning disable 618
var webView = new WebViewCompatible();
var webView = new WebView2();
window.Content = webView;

webView.NavigationStarting += (sender, e) =>
{
#if NET6_0
if (e.Uri.StartsWith(options.EndUrl))
#else
if (e.Uri.AbsoluteUri.StartsWith(options.EndUrl))
#endif
{
tcs.SetResult(new BrowserResult { ResultType = BrowserResultType.Success, Response = e.Uri.ToString() });
if (_shouldCloseWindow)
Expand All @@ -82,12 +74,8 @@ public async Task<BrowserResult> InvokeAsync(BrowserOptions options, Cancellatio

window.Show();

#if NET6_0
await webView.EnsureCoreWebView2Async();
webView.CoreWebView2.Navigate(options.StartUrl);
#else
webView.Navigate(options.StartUrl);
#endif

return await tcs.Task;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
<When Condition="'$(TargetFramework)'!='net6.0-windows'">
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Toolkit.Forms.UI.Controls.WebView">
<Version>6.1.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1823.32" />
</ItemGroup>
</When>
<When Condition="'$(TargetFramework)'=='net6.0-windows'">
Expand Down
16 changes: 2 additions & 14 deletions src/Auth0.OidcClient.WinForms/WebViewBrowser.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using IdentityModel.OidcClient.Browser;
#if NET6_0
using WebViewCompatible = Microsoft.Web.WebView2.WinForms.WebView2;
#else
using Microsoft.Toolkit.Forms.UI.Controls;
#endif
using Microsoft.Web.WebView2.WinForms;
using System;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -52,15 +48,11 @@ public async Task<BrowserResult> InvokeAsync(BrowserOptions options, Cancellatio

var window = _formFactory();
#pragma warning disable 618
var webView = new WebViewCompatible { Dock = DockStyle.Fill };
var webView = new WebView2 { Dock = DockStyle.Fill };

webView.NavigationStarting += (sender, e) =>
{
#if NET6_0
if (e.Uri.StartsWith(options.EndUrl))
#else
if (e.Uri.AbsoluteUri.StartsWith(options.EndUrl))
#endif
{
tcs.SetResult(new BrowserResult { ResultType = BrowserResultType.Success, Response = e.Uri.ToString() });
window.Close();
Expand All @@ -77,12 +69,8 @@ public async Task<BrowserResult> InvokeAsync(BrowserOptions options, Cancellatio

window.Show();

#if NET6_0
await webView.EnsureCoreWebView2Async();
webView.CoreWebView2.Navigate(options.StartUrl);
#else
webView.Navigate(options.StartUrl);
#endif

return await tcs.Task;
}
Expand Down

0 comments on commit 217a8e6

Please sign in to comment.