@@ -111,10 +111,10 @@ public static bool Authenticate(IRequest req, object requestDto=null, IAuthSessi
111111
112112 req . PopulateFromRequestIfHasSessionId ( requestDto ) ;
113113
114- if ( ! req . Items . ContainsKey ( Keywords . HasPreAuthenticated ) )
114+ if ( ! req . IsSet ( Keywords . HasPreAuthenticated ) )
115115 {
116116 var mockResponse = new BasicRequest ( ) . Response ;
117- req . Items [ Keywords . HasPreAuthenticated ] = true ;
117+ req . SetTrue ( Keywords . HasPreAuthenticated ) ;
118118 foreach ( var authWithRequest in authProviders . OfType < IAuthWithRequest > ( ) )
119119 {
120120 authWithRequest . PreAuthenticateAsync ( req , mockResponse ) . Wait ( ) ;
@@ -148,11 +148,11 @@ public static async Task<bool> AuthenticateAsync(IRequest req, object requestDto
148148
149149 req . PopulateFromRequestIfHasSessionId ( requestDto ) ;
150150
151- if ( ! req . Items . ContainsKey ( Keywords . HasPreAuthenticated ) )
151+ if ( ! req . IsSet ( Keywords . HasPreAuthenticated ) )
152152 {
153153 //Unauthorized or invalid requests will terminate the response and return false
154154 var mockResponse = new BasicRequest ( ) . Response ;
155- req . Items [ Keywords . HasPreAuthenticated ] = true ;
155+ req . SetTrue ( Keywords . HasPreAuthenticated ) ;
156156 foreach ( var authWithRequest in authProviders . OfType < IAuthWithRequest > ( ) )
157157 {
158158 await authWithRequest . PreAuthenticateAsync ( req , mockResponse ) . ConfigAwait ( ) ;
@@ -210,9 +210,9 @@ internal static async Task PreAuthenticateAsync(IRequest req, IEnumerable<IAuthP
210210 }
211211
212212 //Call before GetSession so Exceptions can bubble
213- if ( ! req . Items . ContainsKey ( Keywords . HasPreAuthenticated ) )
213+ if ( ! req . IsSet ( Keywords . HasPreAuthenticated ) )
214214 {
215- req . Items [ Keywords . HasPreAuthenticated ] = true ;
215+ req . SetTrue ( Keywords . HasPreAuthenticated ) ;
216216 foreach ( var authWithRequest in authProviders . OfType < IAuthWithRequest > ( ) )
217217 {
218218 await authWithRequest . PreAuthenticateAsync ( req , req . Response ) . ConfigAwait ( ) ;
@@ -232,7 +232,7 @@ protected virtual Task HandleShortCircuitedErrors(IRequest req, IResponse res, o
232232 HttpStatusCode statusCode , string statusDescription = null )
233233 {
234234 if ( HtmlRedirect != null )
235- req . Items [ nameof ( AuthFeature . HtmlRedirect ) ] = HtmlRedirect ;
235+ req . SetItem ( nameof ( AuthFeature . HtmlRedirect ) , HtmlRedirect ) ;
236236
237237 return HostContext . AppHost . HandleShortCircuitedErrors ( req , res , requestDto , statusCode , statusDescription ) ;
238238 }
0 commit comments