@@ -153,20 +153,6 @@ public virtual void Authenticate(IAuthenticateContext context)
153153 }
154154 }
155155
156- public AuthenticationTicket Authenticate ( )
157- {
158- return LazyInitializer . EnsureInitialized (
159- ref _authenticate ,
160- ref _authenticateInitialized ,
161- ref _authenticateSyncLock ,
162- ( ) =>
163- {
164- return Task . FromResult ( AuthenticateCore ( ) ) ;
165- } ) . Result ;
166- }
167-
168- protected abstract AuthenticationTicket AuthenticateCore ( ) ;
169-
170156 public virtual async Task AuthenticateAsync ( IAuthenticateContext context )
171157 {
172158 if ( context . AuthenticationTypes . Contains ( BaseOptions . AuthenticationType , StringComparer . Ordinal ) )
@@ -176,6 +162,10 @@ public virtual async Task AuthenticateAsync(IAuthenticateContext context)
176162 {
177163 context . Authenticated ( ticket . Identity , ticket . Properties . Dictionary , BaseOptions . Description . Dictionary ) ;
178164 }
165+ else
166+ {
167+ context . NotAuthenticated ( BaseOptions . AuthenticationType , properties : null , description : BaseOptions . Description . Dictionary ) ;
168+ }
179169 }
180170
181171 if ( PriorHandler != null )
@@ -184,6 +174,20 @@ public virtual async Task AuthenticateAsync(IAuthenticateContext context)
184174 }
185175 }
186176
177+ public AuthenticationTicket Authenticate ( )
178+ {
179+ return LazyInitializer . EnsureInitialized (
180+ ref _authenticate ,
181+ ref _authenticateInitialized ,
182+ ref _authenticateSyncLock ,
183+ ( ) =>
184+ {
185+ return Task . FromResult ( AuthenticateCore ( ) ) ;
186+ } ) . Result ;
187+ }
188+
189+ protected abstract AuthenticationTicket AuthenticateCore ( ) ;
190+
187191 /// <summary>
188192 /// Causes the authentication logic in AuthenticateCore to be performed for the current request
189193 /// at most once and returns the results. Calling Authenticate more than once will always return
0 commit comments