88using Microsoft . Extensions . Options ;
99using MimeKit ;
1010using Newtonsoft . Json ;
11- using Newtonsoft . Json . Linq ;
1211using System . IdentityModel . Tokens . Jwt ;
13- using System . Net . Mail ;
1412using System . Text ;
1513using WebAppTest . Controllers . Models ;
1614
@@ -24,7 +22,7 @@ public class SampleIMAPController : Controller
2422 private readonly IOptionsMonitor < OAuth2Settings > _oauth2Settings ;
2523 private readonly IHttpClientFactory _httpClientFactory ;
2624
27- private static Dictionary < string , SampleIMAPModel > InMemoryDb = new Dictionary < string , SampleIMAPModel > ( ) ;
25+ private static Dictionary < string , SampleIMAPModel > InMemoryDb = new ( ) ;
2826
2927 public SampleIMAPController (
3028 CodeFlowHelper codeFlowHelper ,
@@ -61,7 +59,7 @@ public async Task<IActionResult> CodeFlow()
6159
6260 // In a real world, this will return a redirect to the code challenge url so that
6361 // the user will be immediately prompted with a login page.
64- var model = new SampleIMAPModel ( ) ;
62+ var model = new ( ) ;
6563 model . State = customState ;
6664 model . LoginLink = codeChallengeUrl . AbsoluteUri ;
6765 model . DebugLoginLink = DumpUrl ( model . LoginLink ) ;
@@ -82,7 +80,7 @@ public async Task<IActionResult> ClientFlow(ClientFlowDto dto)
8280
8381 var model = new SampleIMAPModel ( ) ;
8482 await DumpTokenRequest ( request , model ) ;
85-
83+
8684 var client = _httpClientFactory . CreateClient ( "default" ) ;
8785 var response = await client . SendAsync ( request ) ;
8886 if ( ! response . IsSuccessStatusCode )
@@ -227,7 +225,7 @@ public async Task<IActionResult> GetToken()
227225 return View ( "Index" , model ) ;
228226 }
229227
230- private static async Task DumpTokenRequest ( HttpRequestMessage request , SampleIMAPModel model )
228+ private static async Task DumpTokenRequest ( HttpRequestMessage request , SampleIMAPModel model )
231229 {
232230 var content = await request . Content . ReadAsStringAsync ( ) ;
233231 StringBuilder sb = new StringBuilder ( ) ;
@@ -275,8 +273,8 @@ private async Task<IActionResult> TestImapConnection(SampleIMAPModel model)
275273 await ConnectToImap ( model ) ;
276274 return View ( "Index" , model ) ;
277275 }
278-
279- private static async Task ConnectToImap ( SampleIMAPModel model , string email = null )
276+
277+ private static async Task ConnectToImap ( SampleIMAPModel model , string ? email = null )
280278 {
281279 email ??= model . EmailAddress ;
282280 var oauth2_1 = new SaslMechanismOAuth2 ( email , model . AccessToken ) ;
0 commit comments