22// https://github.com/usercode/DragonFly
33// MIT License
44
5- using DragonFly . AspNetCore ;
6- using DragonFly . AspNetCore . Identity . MongoDB ;
75using DragonFly . AspNetCore . Identity . MongoDB . Models ;
86using DragonFly . AspNetCore . Identity . MongoDB . Services . Base ;
97using DragonFly . AspNetCore . Identity . MongoDB . Storages . Models ;
108using DragonFly . Identity . Services ;
119using DragonFly . Security ;
1210using Microsoft . AspNetCore . Authentication ;
13- using Microsoft . AspNetCore . Components . Authorization ;
14- using Microsoft . AspNetCore . Components . Server ;
1511using Microsoft . AspNetCore . Http ;
1612using MongoDB . Driver ;
1713using MongoDB . Driver . Linq ;
@@ -55,7 +51,7 @@ public LoginService(
5551
5652 public async Task < LoginResult > LoginAsync ( string username , string password , bool isPersistent )
5753 {
58- MongoIdentityUser ? user = await Store . Users . AsQueryable ( ) . FirstOrDefaultAsync ( x => x . Username == username ) ;
54+ MongoIdentityUser ? user = await Store . Users . AsQueryable ( ) . FirstOrDefaultAsync ( x => x . Username == username ) . ConfigureAwait ( false ) ;
5955
6056 if ( user == null )
6157 {
@@ -81,7 +77,7 @@ public async Task<LoginResult> LoginAsync(string username, string password, bool
8177
8278 PrincipalContext . Current = principal ;
8379
84- await HttpContextAccessor . HttpContext ! . SignInAsync ( IdentityAuthenticationDefaults . AuthenticationScheme , principal , new AuthenticationProperties ( ) { IsPersistent = isPersistent } ) ;
80+ await HttpContextAccessor . HttpContext ! . SignInAsync ( IdentityAuthenticationDefaults . AuthenticationScheme , principal , new AuthenticationProperties ( ) { IsPersistent = isPersistent } ) . ConfigureAwait ( false ) ;
8581
8682 return new LoginResult ( true ) { Username = user . Username , Claims = claims . Select ( x=> new ClaimItem ( x . Type , x . Value ) ) . ToList ( ) } ;
8783 }
@@ -101,7 +97,7 @@ public async Task Logout()
10197 {
10298 Guid userIdGuid = Guid . Parse ( claimUserId ) ;
10399
104- MongoIdentityUser ? currentUser = await Store . Users . AsQueryable ( ) . FirstOrDefaultAsync ( x => x . Id == userIdGuid ) ;
100+ MongoIdentityUser ? currentUser = await Store . Users . AsQueryable ( ) . FirstOrDefaultAsync ( x => x . Id == userIdGuid ) . ConfigureAwait ( false ) ;
105101
106102 if ( currentUser != null )
107103 {
0 commit comments