Skip to content

Commit 7c821ea

Browse files
more fixes
1 parent 2457f9c commit 7c821ea

4 files changed

Lines changed: 25 additions & 21 deletions

File tree

SecurityService.UnitTests/SecurityServiceManagerTestData.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
namespace SecurityService.UnitTests
22
{
3+
using BusinessLogic.Requests;
4+
using DataTransferObjects;
5+
using Microsoft.AspNetCore.Identity;
6+
using SecurityService.BusinessLogic;
37
using System;
48
using System.Collections.Generic;
59
using System.Linq;
610
using System.Security.Claims;
711
using System.Threading.Tasks;
8-
using BusinessLogic.Requests;
9-
using DataTransferObjects;
10-
using Microsoft.AspNetCore.Identity;
1112

1213
public class TestData{
1314
public static String UserName = "00000001";
@@ -57,22 +58,22 @@ public class TestData{
5758

5859
public static String User3Id = "da6ce793-1ed5-4116-af89-2878b075ec5a";
5960

60-
public static List<IdentityUser> UserList = new List<IdentityUser>{
61-
new IdentityUser{
61+
public static List<ApplicationUser> UserList = new List<ApplicationUser>{
62+
new ApplicationUser{
6263
UserName = "00000001",
6364
NormalizedUserName = "00000001",
6465
Email = "00000001@testemail.com",
6566
NormalizedEmail = "00000001@testemail.com",
6667
Id = TestData.User1Id
6768
},
68-
new IdentityUser{
69+
new ApplicationUser{
6970
UserName = "00000002",
7071
NormalizedUserName = "00000002",
7172
Email = "00000002@testemail.com",
7273
NormalizedEmail = "00000002@testemail.com",
7374
Id = TestData.User2Id
7475
},
75-
new IdentityUser{
76+
new ApplicationUser{
7677
UserName = "00000003",
7778
NormalizedUserName = "00000003",
7879
Email = "00000003@testemail.com",

SecurityService.UserInterface/Pages/Account/Login/Index.cshtml.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Microsoft.AspNetCore.Identity;
88
using Microsoft.AspNetCore.Mvc;
99
using Microsoft.AspNetCore.Mvc.RazorPages;
10+
using SecurityService.BusinessLogic;
1011

1112
namespace IdentityServerHost.Pages.Login;
1213

@@ -18,8 +19,8 @@ namespace IdentityServerHost.Pages.Login;
1819
[AllowAnonymous]
1920
public class Index : PageModel
2021
{
21-
private readonly UserManager<IdentityUser> _userManager;
22-
private readonly SignInManager<IdentityUser> _signInManager;
22+
private readonly UserManager<ApplicationUser> _userManager;
23+
private readonly SignInManager<ApplicationUser> _signInManager;
2324
private readonly IIdentityServerInteractionService _interaction;
2425
private readonly IEventService _events;
2526
private readonly IAuthenticationSchemeProvider _schemeProvider;
@@ -35,8 +36,8 @@ public Index(
3536
IAuthenticationSchemeProvider schemeProvider,
3637
IIdentityProviderStore identityProviderStore,
3738
IEventService events,
38-
UserManager<IdentityUser> userManager,
39-
SignInManager<IdentityUser> signInManager)
39+
UserManager<ApplicationUser> userManager,
40+
SignInManager<ApplicationUser> signInManager)
4041
{
4142
_userManager = userManager;
4243
_signInManager = signInManager;

SecurityService.UserInterface/Pages/Account/Logout/Index.cshtml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@
1010

1111
namespace IdentityServerHost.Pages.Logout;
1212

13+
using SecurityService.BusinessLogic;
1314
using System.Threading.Tasks;
1415

1516
[SecurityHeaders]
1617
[AllowAnonymous]
1718
public class Index : PageModel
1819
{
19-
private readonly SignInManager<IdentityUser> _signInManager;
20+
private readonly SignInManager<ApplicationUser> _signInManager;
2021
private readonly IIdentityServerInteractionService _interaction;
2122
private readonly IEventService _events;
2223

2324
[BindProperty]
2425
public string LogoutId { get; set; }
2526

26-
public Index(SignInManager<IdentityUser> signInManager, IIdentityServerInteractionService interaction, IEventService events)
27+
public Index(SignInManager<ApplicationUser> signInManager, IIdentityServerInteractionService interaction, IEventService events)
2728
{
2829
_signInManager = signInManager;
2930
_interaction = interaction;

SecurityService.UserInterface/Pages/ExternalLogin/Callback.cshtml.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Security.Claims;
21
using Duende.IdentityServer;
32
using Duende.IdentityServer.Events;
43
using Duende.IdentityServer.Services;
@@ -8,21 +7,23 @@
87
using Microsoft.AspNetCore.Identity;
98
using Microsoft.AspNetCore.Mvc;
109
using Microsoft.AspNetCore.Mvc.RazorPages;
10+
using System.Security.Claims;
1111

1212
namespace IdentityServerHost.Pages.ExternalLogin;
1313

14+
using Microsoft.Extensions.Logging;
15+
using SecurityService.BusinessLogic;
1416
using System;
1517
using System.Collections.Generic;
1618
using System.Linq;
1719
using System.Threading.Tasks;
18-
using Microsoft.Extensions.Logging;
1920

2021
[AllowAnonymous]
2122
[SecurityHeaders]
2223
public class Callback : PageModel
2324
{
24-
private readonly UserManager<IdentityUser> _userManager;
25-
private readonly SignInManager<IdentityUser> _signInManager;
25+
private readonly UserManager<ApplicationUser> _userManager;
26+
private readonly SignInManager<ApplicationUser> _signInManager;
2627
private readonly IIdentityServerInteractionService _interaction;
2728
private readonly ILogger<Callback> _logger;
2829
private readonly IEventService _events;
@@ -31,8 +32,8 @@ public Callback(
3132
IIdentityServerInteractionService interaction,
3233
IEventService events,
3334
ILogger<Callback> logger,
34-
UserManager<IdentityUser> userManager,
35-
SignInManager<IdentityUser> signInManager)
35+
UserManager<ApplicationUser> userManager,
36+
SignInManager<ApplicationUser> signInManager)
3637
{
3738
_userManager = userManager;
3839
_signInManager = signInManager;
@@ -112,11 +113,11 @@ public async Task<IActionResult> OnGet()
112113
return Redirect(returnUrl);
113114
}
114115

115-
private async Task<IdentityUser> AutoProvisionUserAsync(string provider, string providerUserId, IEnumerable<Claim> claims)
116+
private async Task<ApplicationUser> AutoProvisionUserAsync(string provider, string providerUserId, IEnumerable<Claim> claims)
116117
{
117118
var sub = Guid.NewGuid().ToString();
118119

119-
var user = new IdentityUser()
120+
var user = new ApplicationUser()
120121
{
121122
Id = sub,
122123
UserName = sub, // don't need a username, since the user will be using an external provider to login

0 commit comments

Comments
 (0)