Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
victorioustr committed Dec 29, 2022
1 parent ce9ea44 commit 7fb93cc
Show file tree
Hide file tree
Showing 424 changed files with 36,807 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand Down Expand Up @@ -360,4 +358,5 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd
/EvaExchange/WebAPI/logs
Binary file added Database Diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions EvaExchange.sln
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 EvaExchange/Business/Adapters/PersonService/IPersonService.cs
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);
}
}
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;
}
}
}
}
10 changes: 10 additions & 0 deletions EvaExchange/Business/Adapters/SmsService/ISmsService.cs
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 EvaExchange/Business/Adapters/SmsService/SmsServiceManager.cs
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);
}
}
}
36 changes: 36 additions & 0 deletions EvaExchange/Business/Business.csproj
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>
52 changes: 52 additions & 0 deletions EvaExchange/Business/BusinessAspects/SecuredOperation.cs
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);
}
}
}
27 changes: 27 additions & 0 deletions EvaExchange/Business/ConfigurationManager.cs
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; }
}
}
Loading

0 comments on commit 7fb93cc

Please sign in to comment.