feat: LdapOptions erstellt anstelle statischer (fest codierter) Konfigurationswerte, LdapOptions und Abhängigkeitsinjektionen dafür hinzugefügt

This commit is contained in:
Developer 02
2024-08-05 14:18:20 +02:00
parent bc04c2d36d
commit d434a5964b
8 changed files with 105 additions and 21 deletions

View File

@@ -18,10 +18,13 @@ namespace StaffDBServer.SharedControllers
WebAppEmployeeInfoRepository webAppEmployeeInfoRepository;
public WebAppUserHelper(WebAppUserRepository webAppUserRepository, WebAppEmployeeInfoRepository webAppEmployeeInfoRepository)
private readonly JwtManager _jwtManager;
public WebAppUserHelper(WebAppUserRepository webAppUserRepository, WebAppEmployeeInfoRepository webAppEmployeeInfoRepository, JwtManager jwtManager)
{
this.webAppUserRepository = webAppUserRepository;
this.webAppEmployeeInfoRepository = webAppEmployeeInfoRepository;
_jwtManager = jwtManager;
}
public async Task<WebAppUser> CheckLoginWithJWTAsync(StringValues accessToken, string clientVersion)
@@ -96,7 +99,7 @@ namespace StaffDBServer.SharedControllers
}
}
private static async Task<WebAppUser> DoCheckLoginWithNameAndPasswordAsync(WebAppUser userFromClient, WebAppUserRepository webAppUserRepository, WebAppEmployeeInfoRepository webAppEmployeeInfoRepository)
private async Task<WebAppUser> DoCheckLoginWithNameAndPasswordAsync(WebAppUser userFromClient, WebAppUserRepository webAppUserRepository, WebAppEmployeeInfoRepository webAppEmployeeInfoRepository)
{
try
{
@@ -114,7 +117,7 @@ namespace StaffDBServer.SharedControllers
}
LdapUser ldapUser = new LdapUser(userFromClient.LoginName, webAppEmployeeInfo.EmployeeId, userFromClient.Password, webAppEmployeeInfo.DepartmentId, webAppEmployeeInfo.ExtendedDepartmentIdList);
if (!JwtManager.GenerateLdapUserWithJwtToken(ldapUser))
if (!_jwtManager.GenerateLdapUserWithJwtToken(ldapUser))
{
if (ldapUser == default)
{