Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#nullable enable
override Microsoft.AspNetCore.Components.WebAssembly.Authentication.AuthorizationMessageHandler.Dispose(bool disposing) -> void
~Microsoft.AspNetCore.Components.WebAssembly.Authentication.OidcProviderOptions.AdditionalProviderParameters.get -> System.Collections.Generic.IDictionary<string, string>
~Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService<TRemoteAuthenticationState, TAccount, TProviderOptions>.RemoteAuthenticationService(Microsoft.JSInterop.IJSRuntime jsRuntime, Microsoft.Extensions.Options.IOptionsSnapshot<Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationOptions<TProviderOptions>> options, Microsoft.AspNetCore.Components.NavigationManager navigation, Microsoft.AspNetCore.Components.WebAssembly.Authentication.AccountClaimsPrincipalFactory<TAccount> accountClaimsPrincipalFactory) -> void
*REMOVED*~Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService<TRemoteAuthenticationState, TAccount, TProviderOptions>.RemoteAuthenticationService(Microsoft.JSInterop.IJSRuntime jsRuntime, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationOptions<TProviderOptions>> options, Microsoft.AspNetCore.Components.NavigationManager navigation, Microsoft.AspNetCore.Components.WebAssembly.Authentication.AccountClaimsPrincipalFactory<TAccount> accountClaimsPrincipalFactory) -> void
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class RemoteAuthenticatorViewCore<TAuthenticationState> : ComponentBase w
[Parameter] public EventCallback<TAuthenticationState> OnLogOutSucceeded { get; set; }

/// <summary>
/// Gets or sets the <see cref="IJSRuntime"/> to use for performin JavaScript interop.
/// Gets or sets the <see cref="IJSRuntime"/> to use for performing JavaScript interop.
/// </summary>
[Inject] internal IJSRuntime JS { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Authorization;

namespace Microsoft.AspNetCore.Components.WebAssembly.Authentication
{
Expand All @@ -20,6 +21,7 @@ public class AuthorizationMessageHandler : DelegatingHandler
{
private readonly IAccessTokenProvider _provider;
private readonly NavigationManager _navigation;
private readonly AuthenticationStateChangedHandler _authenticationStateChangedHandler;
private AccessToken _lastToken;
private AuthenticationHeaderValue _cachedHeader;
private Uri[] _authorizedUris;
Expand All @@ -36,6 +38,13 @@ public AuthorizationMessageHandler(
{
_provider = provider;
_navigation = navigation;

// Invalidate the cached _lastToken when the authentication state changes
if (_provider is AuthenticationStateProvider authStateProvider)
{
_authenticationStateChangedHandler = _ => { _lastToken = null; };
authStateProvider.AuthenticationStateChanged += _authenticationStateChangedHandler;
}
}

/// <inheritdoc />
Expand Down Expand Up @@ -120,5 +129,16 @@ public AuthorizationMessageHandler ConfigureHandler(

return this;
}

/// <inheritdoc />
protected override void Dispose(bool disposing)
{
if (_provider is AuthenticationStateProvider authStateProvider)
{
authStateProvider.AuthenticationStateChanged -= _authenticationStateChangedHandler;
}

base.Dispose(disposing);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"Wasm.Authentication.Server": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand All @@ -19,6 +20,7 @@
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down