-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce9ea44
commit 7fb93cc
Showing
424 changed files
with
36,807 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.4.33110.190 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAPI", "EvaExchange\WebAPI\WebAPI.csproj", "{119A41B2-F5F1-4F62-B41E-973DFF28288C}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "EvaExchange\Tests\Tests.csproj", "{9568CA5E-3DDC-484F-8FA4-EFEE57E17C04}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Business", "EvaExchange\Business\Business.csproj", "{835C7F1A-2C09-4ECD-ADD6-FCC26FD2633A}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataAccess", "EvaExchange\DataAccess\DataAccess.csproj", "{E73D74BA-FCD9-431D-B748-0C0550B64AB4}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "EvaExchange\Core\Core.csproj", "{7B9B0D4C-B969-49A5-AEC5-4C1F686C4E05}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Entities", "EvaExchange\Entities\Entities.csproj", "{8947DC03-DB9E-4169-BBF6-C7218981E6AA}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{119A41B2-F5F1-4F62-B41E-973DFF28288C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{119A41B2-F5F1-4F62-B41E-973DFF28288C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{119A41B2-F5F1-4F62-B41E-973DFF28288C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{119A41B2-F5F1-4F62-B41E-973DFF28288C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{9568CA5E-3DDC-484F-8FA4-EFEE57E17C04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{9568CA5E-3DDC-484F-8FA4-EFEE57E17C04}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{9568CA5E-3DDC-484F-8FA4-EFEE57E17C04}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{9568CA5E-3DDC-484F-8FA4-EFEE57E17C04}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{835C7F1A-2C09-4ECD-ADD6-FCC26FD2633A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{835C7F1A-2C09-4ECD-ADD6-FCC26FD2633A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{835C7F1A-2C09-4ECD-ADD6-FCC26FD2633A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{835C7F1A-2C09-4ECD-ADD6-FCC26FD2633A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{E73D74BA-FCD9-431D-B748-0C0550B64AB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E73D74BA-FCD9-431D-B748-0C0550B64AB4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E73D74BA-FCD9-431D-B748-0C0550B64AB4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E73D74BA-FCD9-431D-B748-0C0550B64AB4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{7B9B0D4C-B969-49A5-AEC5-4C1F686C4E05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{7B9B0D4C-B969-49A5-AEC5-4C1F686C4E05}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{7B9B0D4C-B969-49A5-AEC5-4C1F686C4E05}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{7B9B0D4C-B969-49A5-AEC5-4C1F686C4E05}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{8947DC03-DB9E-4169-BBF6-C7218981E6AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{8947DC03-DB9E-4169-BBF6-C7218981E6AA}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{8947DC03-DB9E-4169-BBF6-C7218981E6AA}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{8947DC03-DB9E-4169-BBF6-C7218981E6AA}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {0823BC9C-83F4-4FD7-8C30-E3DE21DAF546} | ||
EndGlobalSection | ||
EndGlobal |
10 changes: 10 additions & 0 deletions
10
EvaExchange/Business/Adapters/PersonService/IPersonService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Entities.Dtos; | ||
using System.Threading.Tasks; | ||
|
||
namespace Business.Adapters.PersonService | ||
{ | ||
public interface IPersonService | ||
{ | ||
Task<bool> VerifyCid(Citizen citizen); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
EvaExchange/Business/Adapters/PersonService/PersonServiceManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Entities.Dtos; | ||
using System.Globalization; | ||
using System.Threading.Tasks; | ||
using wsKPSPublic; | ||
|
||
namespace Business.Adapters.PersonService | ||
{ | ||
public class PersonServiceManager : IPersonService | ||
{ | ||
public async Task<bool> VerifyCid(Citizen citizen) | ||
{ | ||
return await Verify(citizen); | ||
} | ||
|
||
private static async Task<bool> Verify(Citizen citizen) | ||
{ | ||
var locale = new CultureInfo("tr-TR", false); | ||
var svc = new KPSPublicSoapClient(KPSPublicSoapClient.EndpointConfiguration.KPSPublicSoap); | ||
{ | ||
var cmd = await svc.TCKimlikNoDogrulaAsync( | ||
citizen.CitizenId, | ||
citizen.Name.ToUpper(locale), | ||
citizen.Surname.ToUpper(locale), | ||
citizen.BirthYear); | ||
return cmd.Body.TCKimlikNoDogrulaResult; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace Business.Adapters.SmsService | ||
{ | ||
public interface ISmsService | ||
{ | ||
Task<bool> Send(string password, string text, string cellPhone); | ||
Task<bool> SendAssist(string text, string cellPhone); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
EvaExchange/Business/Adapters/SmsService/SmsServiceManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace Business.Adapters.SmsService | ||
{ | ||
public class SmsServiceManager : ISmsService | ||
{ | ||
public async Task<bool> Send(string password, string text, string cellPhone) | ||
{ | ||
Thread.Sleep(1000); | ||
return await Task.FromResult(true); | ||
} | ||
|
||
public async Task<bool> SendAssist(string text, string cellPhone) | ||
{ | ||
Thread.Sleep(1000); | ||
return await Task.FromResult(true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.1</TargetFramework> | ||
<LangVersion>8.0</LangVersion> | ||
<Version>1.0.0</Version> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Remove="Helpers\EnumerableExtensions.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AutoMapper" Version="10.1.1" /> | ||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" /> | ||
<PackageReference Include="FluentValidation" Version="10.3.3" /> | ||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="10.3.3" /> | ||
<PackageReference Include="MediatR" Version="9.0.0" /> | ||
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.9" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.9" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.9" /> | ||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" /> | ||
<PackageReference Include="Refit" Version="6.0.94" /> | ||
<PackageReference Include="System.ServiceModel.Duplex" Version="4.8.1" /> | ||
<PackageReference Include="System.ServiceModel.Http" Version="4.8.1" /> | ||
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.8.1" /> | ||
<PackageReference Include="System.ServiceModel.Security" Version="4.8.1" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\DataAccess\DataAccess.csproj" /> | ||
<ProjectReference Include="..\Entities\Entities.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<WCFMetadata Include="Connected Services" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using Business.Constants; | ||
using Castle.DynamicProxy; | ||
using Core.CrossCuttingConcerns.Caching; | ||
using Core.Utilities.Interceptors; | ||
using Core.Utilities.IoC; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Security; | ||
|
||
namespace Business.BusinessAspects | ||
{ | ||
/// <summary> | ||
/// This Aspect control the user's roles in HttpContext by inject the IHttpContextAccessor. | ||
/// It is checked by writing as [SecuredOperation] on the handler. | ||
/// If a valid authorization cannot be found in aspect, it throws an exception. | ||
/// </summary> | ||
public class SecuredOperation : MethodInterception | ||
{ | ||
private readonly IHttpContextAccessor _httpContextAccessor; | ||
private readonly ICacheManager _cacheManager; | ||
|
||
|
||
public SecuredOperation() | ||
{ | ||
_httpContextAccessor = ServiceTool.ServiceProvider.GetService<IHttpContextAccessor>(); | ||
_cacheManager = ServiceTool.ServiceProvider.GetService<ICacheManager>(); | ||
} | ||
|
||
protected override void OnBefore(IInvocation invocation) | ||
{ | ||
var userId = _httpContextAccessor.HttpContext?.User.Claims | ||
.FirstOrDefault(x => x.Type.EndsWith("nameidentifier"))?.Value; | ||
|
||
if (userId == null) | ||
{ | ||
throw new SecurityException(Messages.AuthorizationsDenied); | ||
} | ||
|
||
var oprClaims = _cacheManager.Get<IEnumerable<string>>($"{CacheKeys.UserIdForClaim}={userId}"); | ||
|
||
var operationName = invocation.TargetType.ReflectedType.Name; | ||
if (oprClaims.Contains(operationName)) | ||
{ | ||
return; | ||
} | ||
|
||
throw new SecurityException(Messages.AuthorizationsDenied); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Hosting; | ||
using System; | ||
|
||
namespace Business | ||
{ | ||
public enum ApplicationMode | ||
{ | ||
Development, | ||
Profiling, | ||
Staging, | ||
Production, | ||
} | ||
|
||
public class ConfigurationManager | ||
{ | ||
private readonly IConfiguration _configuration; | ||
|
||
public ConfigurationManager(IConfiguration configuration, IHostEnvironment env) | ||
{ | ||
_configuration = configuration; | ||
Mode = (ApplicationMode)Enum.Parse(typeof(ApplicationMode), env.EnvironmentName); | ||
} | ||
|
||
public ApplicationMode Mode { get; private set; } | ||
} | ||
} |
Oops, something went wrong.