@@ -31,7 +31,7 @@ public class RemoteAuthenticationService<
31
31
{
32
32
private static readonly TimeSpan _userCacheRefreshInterval = TimeSpan . FromSeconds ( 60 ) ;
33
33
private bool _initialized ;
34
- private readonly JavaScriptLoggingOptions _loggingOptions ;
34
+ private readonly RemoteAuthenticationServiceJavaScriptLoggingOptions _loggingOptions ;
35
35
36
36
// This defaults to 1/1/1970
37
37
private DateTimeOffset _userLastCheck = DateTimeOffset . FromUnixTimeSeconds ( 0 ) ;
@@ -93,7 +93,11 @@ public RemoteAuthenticationService(
93
93
Navigation = navigation ;
94
94
AccountClaimsPrincipalFactory = accountClaimsPrincipalFactory ;
95
95
Options = options . Value ;
96
- _loggingOptions = new JavaScriptLoggingOptions ( logger ? . IsEnabled ( LogLevel . Debug ) ?? false , logger ? . IsEnabled ( LogLevel . Trace ) ?? false ) ;
96
+ _loggingOptions = new RemoteAuthenticationServiceJavaScriptLoggingOptions
97
+ {
98
+ DebugEnabled = logger ? . IsEnabled ( LogLevel . Debug ) ?? false ,
99
+ TraceEnabled = logger ? . IsEnabled ( LogLevel . Trace ) ?? false
100
+ } ;
97
101
}
98
102
99
103
/// <inheritdoc />
@@ -163,6 +167,7 @@ public virtual async ValueTask<AccessTokenResult> RequestAccessToken()
163
167
/// <inheritdoc />
164
168
[ DynamicDependency ( JsonSerialized , typeof ( AccessToken ) ) ]
165
169
[ DynamicDependency ( JsonSerialized , typeof ( AccessTokenRequestOptions ) ) ]
170
+
166
171
public virtual async ValueTask < AccessTokenResult > RequestAccessToken ( AccessTokenRequestOptions options )
167
172
{
168
173
if ( options is null )
@@ -215,6 +220,7 @@ protected internal virtual async ValueTask<ClaimsPrincipal> GetAuthenticatedUser
215
220
return user ;
216
221
}
217
222
223
+ [ DynamicDependency ( JsonSerialized , typeof ( RemoteAuthenticationServiceJavaScriptLoggingOptions ) ) ]
218
224
private async ValueTask EnsureAuthService ( )
219
225
{
220
226
if ( ! _initialized )
@@ -240,7 +246,15 @@ private void UpdateUser(Task<ClaimsPrincipal> task)
240
246
static async Task < AuthenticationState > UpdateAuthenticationState ( Task < ClaimsPrincipal > futureUser ) => new AuthenticationState ( await futureUser ) ;
241
247
}
242
248
243
- private record JavaScriptLoggingOptions ( bool DebugEnabled , bool TraceEnabled ) ;
249
+ }
250
+
251
+ // We need to do this as it can't be nested inside RemoteAuthenticationService because
252
+ // it needs to be put in an attribute for linking purposes and that can't be an open generic type.
253
+ internal class RemoteAuthenticationServiceJavaScriptLoggingOptions
254
+ {
255
+ public bool DebugEnabled { get ; set ; }
256
+
257
+ public bool TraceEnabled { get ; set ; }
244
258
}
245
259
246
260
// Internal for testing purposes
0 commit comments