This repository was archived by the owner on Sep 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed
src/IdentityModel.AspNetCore.OAuth2Introspection Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -17,21 +17,25 @@ public AsyncLazy(Func<Task<T>> taskFactory)
17
17
_taskFactory = taskFactory ;
18
18
_lazyTaskFactory = InitLazy ( _taskFactory ) ;
19
19
}
20
-
21
- public Task < T > GetAsync ( )
22
- {
23
- //If the lazy value is not yet created, we should just return the lazy value (which will create it)
24
- //If the value has been created and the value (which is a Task<T>) is not faulted, we should just return the value;
25
- if ( ! ( _lazyTaskFactory . IsValueCreated && _lazyTaskFactory . Value . IsFaulted ) ) return _lazyTaskFactory . Value ;
26
20
27
- lock ( _lazyInitializationGuard )
21
+ public Task < T > Value
22
+ {
23
+ get
28
24
{
29
- if ( _lazyTaskFactory . IsValueCreated && _lazyTaskFactory . Value . IsFaulted )
25
+ //If the lazy value is not yet created, we should just return the lazy value (which will create it)
26
+ //If the value has been created and the value (which is a Task<T>) is not faulted, we should just return the value;
27
+ if ( ! ( _lazyTaskFactory . IsValueCreated && _lazyTaskFactory . Value . IsFaulted ) )
28
+ return _lazyTaskFactory . Value ;
29
+
30
+ lock ( _lazyInitializationGuard )
30
31
{
31
- _lazyTaskFactory = InitLazy ( _taskFactory ) ;
32
- }
32
+ if ( _lazyTaskFactory . IsValueCreated && _lazyTaskFactory . Value . IsFaulted )
33
+ {
34
+ _lazyTaskFactory = InitLazy ( _taskFactory ) ;
35
+ }
33
36
34
- return _lazyTaskFactory . Value ;
37
+ return _lazyTaskFactory . Value ;
38
+ }
35
39
}
36
40
}
37
41
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
91
91
92
92
try
93
93
{
94
- var response = await lazyIntrospection . GetAsync ( ) . ConfigureAwait ( false ) ;
94
+ var response = await lazyIntrospection . Value . ConfigureAwait ( false ) ;
95
95
96
96
if ( response . IsError )
97
97
{
@@ -139,7 +139,7 @@ private AsyncLazy<IntrospectionResponse> CreateLazyIntrospection(string token)
139
139
140
140
private async Task < IntrospectionResponse > LoadClaimsForToken ( string token )
141
141
{
142
- var introspectionClient = await Options . IntrospectionClient . GetAsync ( ) . ConfigureAwait ( false ) ;
142
+ var introspectionClient = await Options . IntrospectionClient . Value . ConfigureAwait ( false ) ;
143
143
144
144
return await introspectionClient . SendAsync ( new IntrospectionRequest
145
145
{
You can’t perform that action at this time.
0 commit comments