2
2
// https://github.com/usercode/DragonFly
3
3
// MIT License
4
4
5
- using DragonFly . AspNetCore ;
6
- using DragonFly . AspNetCore . Identity . MongoDB ;
7
5
using DragonFly . AspNetCore . Identity . MongoDB . Models ;
8
6
using DragonFly . AspNetCore . Identity . MongoDB . Services . Base ;
9
7
using DragonFly . AspNetCore . Identity . MongoDB . Storages . Models ;
10
8
using DragonFly . Identity . Services ;
11
9
using DragonFly . Security ;
12
10
using Microsoft . AspNetCore . Authentication ;
13
- using Microsoft . AspNetCore . Components . Authorization ;
14
- using Microsoft . AspNetCore . Components . Server ;
15
11
using Microsoft . AspNetCore . Http ;
16
12
using MongoDB . Driver ;
17
13
using MongoDB . Driver . Linq ;
@@ -55,7 +51,7 @@ public LoginService(
55
51
56
52
public async Task < LoginResult > LoginAsync ( string username , string password , bool isPersistent )
57
53
{
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 ) ;
59
55
60
56
if ( user == null )
61
57
{
@@ -81,7 +77,7 @@ public async Task<LoginResult> LoginAsync(string username, string password, bool
81
77
82
78
PrincipalContext . Current = principal ;
83
79
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 ) ;
85
81
86
82
return new LoginResult ( true ) { Username = user . Username , Claims = claims . Select ( x=> new ClaimItem ( x . Type , x . Value ) ) . ToList ( ) } ;
87
83
}
@@ -101,7 +97,7 @@ public async Task Logout()
101
97
{
102
98
Guid userIdGuid = Guid . Parse ( claimUserId ) ;
103
99
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 ) ;
105
101
106
102
if ( currentUser != null )
107
103
{
0 commit comments