diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/RemoteAuthenticationService.cs b/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/RemoteAuthenticationService.cs
index cfc4f993ead6..b5b15c34562b 100644
--- a/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/RemoteAuthenticationService.cs
+++ b/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/RemoteAuthenticationService.cs
@@ -31,7 +31,7 @@ public class RemoteAuthenticationService<
{
private static readonly TimeSpan _userCacheRefreshInterval = TimeSpan.FromSeconds(60);
private bool _initialized;
- private readonly JavaScriptLoggingOptions _loggingOptions;
+ private readonly RemoteAuthenticationServiceJavaScriptLoggingOptions _loggingOptions;
// This defaults to 1/1/1970
private DateTimeOffset _userLastCheck = DateTimeOffset.FromUnixTimeSeconds(0);
@@ -93,7 +93,11 @@ public RemoteAuthenticationService(
Navigation = navigation;
AccountClaimsPrincipalFactory = accountClaimsPrincipalFactory;
Options = options.Value;
- _loggingOptions = new JavaScriptLoggingOptions(logger?.IsEnabled(LogLevel.Debug) ?? false, logger?.IsEnabled(LogLevel.Trace) ?? false);
+ _loggingOptions = new RemoteAuthenticationServiceJavaScriptLoggingOptions
+ {
+ DebugEnabled = logger?.IsEnabled(LogLevel.Debug) ?? false,
+ TraceEnabled = logger?.IsEnabled(LogLevel.Trace) ?? false
+ };
}
///
@@ -163,6 +167,7 @@ public virtual async ValueTask RequestAccessToken()
///
[DynamicDependency(JsonSerialized, typeof(AccessToken))]
[DynamicDependency(JsonSerialized, typeof(AccessTokenRequestOptions))]
+
public virtual async ValueTask RequestAccessToken(AccessTokenRequestOptions options)
{
if (options is null)
@@ -215,6 +220,7 @@ protected internal virtual async ValueTask GetAuthenticatedUser
return user;
}
+ [DynamicDependency(JsonSerialized, typeof(RemoteAuthenticationServiceJavaScriptLoggingOptions))]
private async ValueTask EnsureAuthService()
{
if (!_initialized)
@@ -240,7 +246,15 @@ private void UpdateUser(Task task)
static async Task UpdateAuthenticationState(Task futureUser) => new AuthenticationState(await futureUser);
}
- private record JavaScriptLoggingOptions(bool DebugEnabled, bool TraceEnabled);
+}
+
+// We need to do this as it can't be nested inside RemoteAuthenticationService because
+// it needs to be put in an attribute for linking purposes and that can't be an open generic type.
+internal class RemoteAuthenticationServiceJavaScriptLoggingOptions
+{
+ public bool DebugEnabled { get; set; }
+
+ public bool TraceEnabled { get; set; }
}
// Internal for testing purposes