diff --git a/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.Logics/EasyMicroservices.AuthenticationsMicroservice.Logics.csproj b/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.Logics/EasyMicroservices.AuthenticationsMicroservice.Logics.csproj
index 6db9de5..7bb3faa 100644
--- a/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.Logics/EasyMicroservices.AuthenticationsMicroservice.Logics.csproj
+++ b/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.Logics/EasyMicroservices.AuthenticationsMicroservice.Logics.csproj
@@ -13,6 +13,7 @@
+
diff --git a/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.Logics/Interfaces/IJWTManager.cs b/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.Logics/Interfaces/IJWTManager.cs
deleted file mode 100644
index 7638688..0000000
--- a/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.Logics/Interfaces/IJWTManager.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using EasyMicroservices.AuthenticationsMicroservice.Contracts;
-using EasyMicroservices.AuthenticationsMicroservice.Contracts.Common;
-using EasyMicroservices.AuthenticationsMicroservice.Contracts.Requests;
-using EasyMicroservices.AuthenticationsMicroservice.Contracts.Responses;
-using EasyMicroservices.AuthenticationsMicroservice.Database.Entities;
-using Microsoft.IdentityModel.Tokens;
-using System.Threading.Tasks;
-using System.Linq;
-using System.Security.Claims;
-using System.Text;
-using EasyMicroservices.ServiceContracts;
-
-namespace EasyMicroservices.AuthenticationsMicroservice.Interfaces
-{
- public interface IJWTManager
- {
- Task> Register(AddUserRequestContract input);
- Task> Login(UserSummaryContract cred);
- Task> GenerateToken(UserClaimContract cred);
-
- }
-}
\ No newline at end of file
diff --git a/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.Services/JWTManager.cs b/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.Services/JWTManager.cs
deleted file mode 100644
index 68cd7c5..0000000
--- a/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.Services/JWTManager.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-//using EasyMicroservices.AuthenticationsMicroservice.Contracts.Common;
-//using EasyMicroservices.AuthenticationsMicroservice.Contracts.Requests;
-//using EasyMicroservices.AuthenticationsMicroservice.Contracts.Responses;
-//using EasyMicroservices.AuthenticationsMicroservice.Database.Entities;
-//using EasyMicroservices.AuthenticationsMicroservice.Helpers;
-//using EasyMicroservices.AuthenticationsMicroservice.Interfaces;
-//using EasyMicroservices.Cores.AspEntityFrameworkCoreApi.Interfaces;
-//using EasyMicroservices.Cores.Database.Interfaces;
-//using EasyMicroservices.ServiceContracts;
-//using Microsoft.Extensions.Configuration;
-//using Microsoft.IdentityModel.Tokens;
-//using System;
-//using System.IdentityModel.Tokens.Jwt;
-//using System.Linq;
-//using System.Security.Claims;
-//using System.Text;
-//using System.Threading.Tasks;
-
-//namespace EasyMicroservices.AuthenticationsMicroservice
-//{
-// public class JWTManager : IJWTManager
-// {
-// private readonly IConfiguration _config;
-// private readonly IUnitOfWork _unitOfWork;
-
-// public JWTManager(IUnitOfWork unitOfWork, IConfiguration config)
-// {
-// _config = config;
-// _unitOfWork = unitOfWork;
-// }
-
-// public virtual async Task> Login(UserSummaryContract cred)
-// {
-// var logic = _unitOfWork.GetLongContractLogic();
-// var user = await logic.GetBy(x => x.UserName == cred.UserName && x.Password == cred.Password);
-// if (!user.IsSuccess)
-// return (FailedReasonType.AccessDenied, "Username or password is invalid."); //"Username or password is invalid."
-
-
-// return user.Result.Id;
-// }
-
-// public virtual async Task> GenerateToken(UserClaimContract cred)
-// {
-// var response = await Login(cred);
-// if (!response)
-// return response.ToContract();
-
-// var logic = _unitOfWork.GetLongContractLogic();
-// var user = await logic.GetBy(x => x.UserName == cred.UserName && x.Password == cred.Password);
-
-// var tokenHandler = new JwtSecurityTokenHandler();
-// var key = Encoding.UTF8.GetBytes(_config.GetValue("JWT:Key"));
-// var tokenDescriptor = new SecurityTokenDescriptor
-// {
-// Subject = new ClaimsIdentity(cred.Claims.Select(x => new Claim(x.Name, x.Value)).ToArray()),
-// Expires = DateTime.UtcNow.AddSeconds(_config.GetValue("JWT:TokenExpireTimeInSeconds")),
-// Issuer = _config.GetValue("JWT:Issuer"),
-// Audience = _config.GetValue("JWT:Audience"),
-// SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
-// };
-// var token = tokenHandler.CreateToken(tokenDescriptor);
-// var tokenString = tokenHandler.WriteToken(token);
-
-// return new UserResponseContract
-// {
-// Token = tokenString,
-// UniqueIdentity = user.Result.UniqueIdentity
-// };
-// }
-
-
-// public virtual async Task> Register(AddUserRequestContract input)
-// {
-// string Password = input.Password;
-// input.Password = await AuthenticationHelper.HashPassword(input.Password);
-
-// var logic = _unitOfWork.GetLongContractLogic();
-// var usersRecords = await logic.GetBy(x => x.UserName == input.UserName.ToLower());
-
-// if (usersRecords.IsSuccess)
-// return (FailedReasonType.Duplicate, "User already exists!");
-
-// var user = await logic.Add(input);
-
-// return user;
-// }
-// }
-//}
diff --git a/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.WebApi/Controllers/UserController.cs b/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.WebApi/Controllers/UserController.cs
index a58f62a..ac75449 100644
--- a/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.WebApi/Controllers/UserController.cs
+++ b/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.WebApi/Controllers/UserController.cs
@@ -3,7 +3,6 @@
using EasyMicroservices.AuthenticationsMicroservice.Contracts.Responses;
using EasyMicroservices.AuthenticationsMicroservice.Database.Entities;
using EasyMicroservices.AuthenticationsMicroservice.Helpers;
-using EasyMicroservices.AuthenticationsMicroservice.Interfaces;
using EasyMicroservices.Cores.AspCoreApi;
using EasyMicroservices.Cores.AspEntityFrameworkCoreApi.Interfaces;
using EasyMicroservices.ServiceContracts;
@@ -15,12 +14,10 @@ namespace EasyMicroservices.AuthenticationsMicroservice.WebApi.Controllers
public class UsersController : SimpleQueryServiceController
{
private readonly IUnitOfWork _unitOfWork;
- //private readonly IJWTManager _jwtManager;
- public UsersController(IUnitOfWork unitOfWork/*, IJWTManager jwtManager*/) : base(unitOfWork)
+ public UsersController(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
- //_jwtManager = jwtManager;
}
[HttpPost]
@@ -35,96 +32,6 @@ public async Task> VerifyUserIdentity(UserSummaryC
return await _unitOfWork.GetContractLogic().GetBy(x => x.UserName == request.UserName && x.Password == request.Password);
}
- //[HttpPost]
- //public async Task> VerifyUserName(VerifyEmailAddressContract request)
- //{
- // var logic = _unitOfWork.GetLongContractLogic();
- // var user = await logic.GetById(new Cores.Contracts.Requests.GetIdRequestContract { Id = request.UserId }).AsCheckedResult();
- // if (user.IsUsernameVerified)
- // return true;
-
- // await logic.Update(new UserContract
- // {
- // CreationDateTime = user.CreationDateTime,
- // DeletedDateTime = user.DeletedDateTime,
- // Id = user.Id,
- // IsDeleted = user.IsDeleted,
- // IsUsernameVerified = true,
- // ModificationDateTime = user.ModificationDateTime,
- // Password = user.Password,
- // UniqueIdentity = user.UniqueIdentity,
- // UserName = user.UserName,
- // }).AsCheckedResult();
-
- // return true;
-
- //}
- //[HttpPost]
- //public async Task> Register(AddUserRequestContract request)
- //{
- // return await _jwtManager.Register(request);
- //}
-
- //[HttpPost]
- //public async Task> Login(UserSummaryContract request)
- //{
- // string password = await AuthenticationHelper.HashPassword(request.Password);
- // request.Password = password;
-
- // var response = await _jwtManager.Login(request);
-
- // return response;
- //}
-
- //[HttpPost]
- //public async Task> GenerateToken(UserClaimContract request)
- //{
- // string password = await AuthenticationHelper.HashPassword(request.Password);
- // request.Password = password;
-
- // var response = await _jwtManager.GenerateToken(request);
-
- // return response;
- //}
-
- //[HttpPost]
- //public async Task> RegenerateToken(RegenerateTokenContract request)
- //{
- // var logic = _unitOfWork.GetLongContractLogic();
- // var user = await logic.GetById(new Cores.Contracts.Requests.GetIdRequestContract
- // {
- // Id = request.UserId
- // });
-
- // if (user)
- // {
-
- // string password = user.Result.Password;
-
- // var req = new UserClaimContract
- // {
- // Password = password,
- // UserName = user.Result.UserName,
- // Claims = request.Claims
- // };
-
- // var response = await _jwtManager.GenerateToken(req);
-
- // return new UserResponseContract
- // {
- // Token = response.Result.Token
- // };
- // }
-
- // return user.ToContract();
- //}
-
- //[HttpGet]
- //[Authorize]
- //public string Test()
- //{
- // return "test";
- //}
-
+
}
}
diff --git a/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.WebApi/Program.cs b/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.WebApi/Program.cs
index 9bcdb06..8fc17f5 100644
--- a/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.WebApi/Program.cs
+++ b/src/CSharp/EasyMicroservices.AuthenticationsMicroservice.WebApi/Program.cs
@@ -1,5 +1,4 @@
using EasyMicroservices.AuthenticationsMicroservice.Database.Contexts;
-using EasyMicroservices.AuthenticationsMicroservice.Interfaces;
using EasyMicroservices.Cores.AspEntityFrameworkCoreApi;
using EasyMicroservices.Cores.AspEntityFrameworkCoreApi.Interfaces;
using EasyMicroservices.Cores.Interfaces;