@@ -6,16 +6,16 @@ public class AuthService : IAuthService
6
6
readonly RoleManager < IdentityRole > roleManager ;
7
7
readonly SignInManager < ApplicationUser > signInManager ;
8
8
readonly IJWTService jwtService ;
9
- readonly IHttpContextAccessor httpContextAccessor ;
9
+ readonly IHttpContextAccessor httpContextAccessor ;
10
10
readonly ILogger < AuthService > logger ;
11
- readonly IConfiguration configuration ;
11
+ readonly IConfiguration configuration ;
12
12
13
13
public AuthService (
14
14
UserManager < ApplicationUser > userManager ,
15
15
RoleManager < IdentityRole > roleManager ,
16
16
SignInManager < ApplicationUser > signInManager ,
17
17
IJWTService jwtService ,
18
- IHttpContextAccessor httpContextAccessor ,
18
+ IHttpContextAccessor httpContextAccessor ,
19
19
ILogger < AuthService > logger ,
20
20
IConfiguration configuration
21
21
)
@@ -24,9 +24,9 @@ IConfiguration configuration
24
24
this . roleManager = roleManager ;
25
25
this . signInManager = signInManager ;
26
26
this . jwtService = jwtService ;
27
- this . httpContextAccessor = httpContextAccessor ;
27
+ this . httpContextAccessor = httpContextAccessor ;
28
28
this . logger = logger ;
29
- this . configuration = configuration ;
29
+ this . configuration = configuration ;
30
30
}
31
31
32
32
public AuthOptions AuthOptions ( )
@@ -151,7 +151,7 @@ public async Task<LoginResponseDto> LoginAsync(
151
151
UserName = userName ,
152
152
Email = user . Email ! ,
153
153
Roles = roles ,
154
- Permissions = PermissionsFromRoles ( roles . ToHashSet ( ) ) ,
154
+ Permissions = PermissionsFromRoles ( roles . ToHashSet ( ) ) ,
155
155
RefreshTokenExpiration = refreshTokenNfo . Expiration
156
156
} ;
157
157
}
@@ -259,7 +259,7 @@ public async Task<RenewAccessTokenResponse> RenewCurrentUserAccessTokenAsync(Can
259
259
var quser = httpContext . User ;
260
260
261
261
if ( quser is not null )
262
- {
262
+ {
263
263
var refreshToken = jwtService . GetRefreshTokenFromHttpRequest ( httpContext . Request ) ;
264
264
if ( refreshToken is null )
265
265
return new RenewAccessTokenResponse { Status = RenewAccessTokenStatus . InvalidRefreshToken } ;
@@ -429,6 +429,8 @@ public async Task<DeleteUserResponseDto> DeleteUserAsync(
429
429
Errors = [ $ "Can't delete user (role:{ editExistingUserMaxRole } )."]
430
430
} ;
431
431
432
+ await userManager . RemoveFromRolesAsync ( userToDelete , await userManager . GetRolesAsync ( userToDelete ) ) ;
433
+
432
434
var deleteRes = await userManager . DeleteAsync ( userToDelete ) ;
433
435
if ( ! deleteRes . Succeeded )
434
436
return new DeleteUserResponseDto
0 commit comments