Browse Source

Added initial Identity rest API.

pull/81/head
Halil İbrahim Kalkan 9 years ago
parent
commit
cbbb136834
  1. 28
      Volo.Abp.sln
  2. 2
      src/AbpDesk/AbpDesk.EntityFrameworkCore/AbpDesk/EntityFrameworkCore/AbpDeskDbConfigurer.cs
  3. 1
      src/AbpDesk/AbpDesk.Web.Mvc/project.json
  4. 6
      src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
  5. 19
      src/Volo.Abp.Identity.Application.Contracts/Properties/AssemblyInfo.cs
  6. 20
      src/Volo.Abp.Identity.Application.Contracts/Volo.Abp.Identity.Application.Contracts.xproj
  7. 14
      src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IUserAppService.cs
  8. 11
      src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs
  9. 13
      src/Volo.Abp.Identity.Application.Contracts/project.json
  10. 19
      src/Volo.Abp.Identity.Application/Properties/AssemblyInfo.cs
  11. 20
      src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.xproj
  12. 14
      src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpIdentityApplicationModule.cs
  13. 60
      src/Volo.Abp.Identity.Application/Volo/Abp/Identity/UserAppService.cs
  14. 14
      src/Volo.Abp.Identity.Application/project.json
  15. 62
      src/Volo.Abp.Identity.HttpApi.Host/AbpIdentityHttpApiHostModule.cs
  16. 20
      src/Volo.Abp.Identity.HttpApi.Host/Program.cs
  17. 27
      src/Volo.Abp.Identity.HttpApi.Host/Properties/launchSettings.json
  18. 23
      src/Volo.Abp.Identity.HttpApi.Host/Startup.cs
  19. 25
      src/Volo.Abp.Identity.HttpApi.Host/Volo.Abp.Identity.HttpApi.Host.xproj
  20. 5
      src/Volo.Abp.Identity.HttpApi.Host/appsettings.Staging.json
  21. 5
      src/Volo.Abp.Identity.HttpApi.Host/appsettings.json
  22. 60
      src/Volo.Abp.Identity.HttpApi.Host/project.json
  23. 14
      src/Volo.Abp.Identity.HttpApi.Host/web.config
  24. 19
      src/Volo.Abp.Identity.HttpApi/Properties/AssemblyInfo.cs
  25. 20
      src/Volo.Abp.Identity.HttpApi/Volo.Abp.Identity.HttpApi.xproj
  26. 15
      src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/AbpIdentityHttpApiModule.cs
  27. 33
      src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUsersController.cs
  28. 14
      src/Volo.Abp.Identity.HttpApi/project.json
  29. 1
      src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUser.cs
  30. 6
      src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs
  31. 23
      src/Volo.Abp/Volo/Abp/Application/Services/Dtos/EntityDto.cs
  32. 16
      src/Volo.Abp/Volo/Abp/Application/Services/Dtos/IEntityDto.cs
  33. 14
      src/Volo.Abp/Volo/Abp/Domain/Repositories/IRepository.cs
  34. 5
      src/Volo.Abp/Volo/Abp/Domain/Repositories/QueryableRepositoryBase.cs
  35. 8
      src/Volo.Abp/Volo/Abp/Domain/Repositories/RepositoryBase.cs
  36. 5
      test/Volo.Abp.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs

28
Volo.Abp.sln

@ -92,6 +92,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Abp.UI", "Abp.UI", "{6F776E
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Volo.Abp.AspNetCore.Mvc.UI.Bootstrap", "src\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.xproj", "{C761A3F7-787D-4C7E-A41C-5FAB07F6B774}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Volo.Abp.Identity.Application.Contracts", "src\Volo.Abp.Identity.Application.Contracts\Volo.Abp.Identity.Application.Contracts.xproj", "{C714A3AB-8402-4DC2-B120-ACCB2E29BD8F}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Volo.Abp.Identity.Application", "src\Volo.Abp.Identity.Application\Volo.Abp.Identity.Application.xproj", "{54592671-9CB6-48AE-9AE0-84CD016E87FF}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Volo.Abp.Identity.HttpApi", "src\Volo.Abp.Identity.HttpApi\Volo.Abp.Identity.HttpApi.xproj", "{57FCA6CB-9D99-411E-8ABF-20ACFBD61D61}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Volo.Abp.Identity.HttpApi.Host", "src\Volo.Abp.Identity.HttpApi.Host\Volo.Abp.Identity.HttpApi.Host.xproj", "{EB902D57-C047-4CDF-828B-FDC204AC7398}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -214,6 +222,22 @@ Global
{C761A3F7-787D-4C7E-A41C-5FAB07F6B774}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C761A3F7-787D-4C7E-A41C-5FAB07F6B774}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C761A3F7-787D-4C7E-A41C-5FAB07F6B774}.Release|Any CPU.Build.0 = Release|Any CPU
{C714A3AB-8402-4DC2-B120-ACCB2E29BD8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C714A3AB-8402-4DC2-B120-ACCB2E29BD8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C714A3AB-8402-4DC2-B120-ACCB2E29BD8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C714A3AB-8402-4DC2-B120-ACCB2E29BD8F}.Release|Any CPU.Build.0 = Release|Any CPU
{54592671-9CB6-48AE-9AE0-84CD016E87FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54592671-9CB6-48AE-9AE0-84CD016E87FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54592671-9CB6-48AE-9AE0-84CD016E87FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54592671-9CB6-48AE-9AE0-84CD016E87FF}.Release|Any CPU.Build.0 = Release|Any CPU
{57FCA6CB-9D99-411E-8ABF-20ACFBD61D61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{57FCA6CB-9D99-411E-8ABF-20ACFBD61D61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{57FCA6CB-9D99-411E-8ABF-20ACFBD61D61}.Release|Any CPU.ActiveCfg = Release|Any CPU
{57FCA6CB-9D99-411E-8ABF-20ACFBD61D61}.Release|Any CPU.Build.0 = Release|Any CPU
{EB902D57-C047-4CDF-828B-FDC204AC7398}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB902D57-C047-4CDF-828B-FDC204AC7398}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB902D57-C047-4CDF-828B-FDC204AC7398}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB902D57-C047-4CDF-828B-FDC204AC7398}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -256,5 +280,9 @@ Global
{B6182BF1-9EC6-403D-A42C-D6441CF7B390} = {4C753F64-0C93-4D65-96C2-A40893AFC1E8}
{6F776E78-862A-4147-86BA-12B6B64E8958} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{C761A3F7-787D-4C7E-A41C-5FAB07F6B774} = {6F776E78-862A-4147-86BA-12B6B64E8958}
{C714A3AB-8402-4DC2-B120-ACCB2E29BD8F} = {1895A5C9-50D4-4568-9A3A-14657E615A5E}
{54592671-9CB6-48AE-9AE0-84CD016E87FF} = {1895A5C9-50D4-4568-9A3A-14657E615A5E}
{57FCA6CB-9D99-411E-8ABF-20ACFBD61D61} = {1895A5C9-50D4-4568-9A3A-14657E615A5E}
{EB902D57-C047-4CDF-828B-FDC204AC7398} = {1895A5C9-50D4-4568-9A3A-14657E615A5E}
EndGlobalSection
EndGlobal

2
src/AbpDesk/AbpDesk.EntityFrameworkCore/AbpDesk/EntityFrameworkCore/AbpDeskDbConfigurer.cs

@ -11,7 +11,7 @@ namespace AbpDesk.EntityFrameworkCore
public static void Configure(IServiceCollection services, IConfigurationRoot configuration)
{
//Configure DbConnectionOptions by configuration file (appsettings.json)
services.Configure<DbConnectionOptions>(configuration);
services.Configure<DbConnectionOptions>(configuration); //TODO: Move to the application. No proper to be in EF Core package.
services.Configure<AbpDbContextOptions>(options =>
{

1
src/AbpDesk/AbpDesk.Web.Mvc/project.json

@ -12,6 +12,7 @@
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"AbpDesk.Application.Contracts": "1.0.0-*",
"Microsoft.EntityFrameworkCore.Tools": {
"type": "build",

6
src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
@ -41,6 +42,11 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
return DbSet.AsQueryable();
}
public override Task<List<TEntity>> GetListAsync(CancellationToken cancellationToken = new CancellationToken())
{
return DbSet.ToListAsync(cancellationToken);
}
public override async Task<TEntity> GetAsync(TPrimaryKey id, CancellationToken cancellationToken = default(CancellationToken))
{
var entity = await FindAsync(id, cancellationToken);

19
src/Volo.Abp.Identity.Application.Contracts/Properties/AssemblyInfo.cs

@ -0,0 +1,19 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Volo.Abp.Identity.Application.Contracts")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c714a3ab-8402-4dc2-b120-accb2e29bd8f")]

20
src/Volo.Abp.Identity.Application.Contracts/Volo.Abp.Identity.Application.Contracts.xproj

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>c714a3ab-8402-4dc2-b120-accb2e29bd8f</ProjectGuid>
<RootNamespace>
</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

14
src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IUserAppService.cs

@ -0,0 +1,14 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Application.Services.Dtos;
namespace Volo.Abp.Identity
{
public interface IUserAppService : IApplicationService
{
Task<ListResultDto<IdentityUserDto>> GetAll();
Task<IdentityUserDto> Get(Guid id);
}
}

11
src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs

@ -0,0 +1,11 @@
using Volo.Abp.Application.Services.Dtos;
namespace Volo.Abp.Identity
{
public class IdentityUserDto : EntityDto
{
public string UserName { get; set; }
public string Email { get; set; }
}
}

13
src/Volo.Abp.Identity.Application.Contracts/project.json

@ -0,0 +1,13 @@
{
"version": "1.0.0-*",
"dependencies": {
"Volo.Abp": "1.0.0-*"
},
"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
}
}

19
src/Volo.Abp.Identity.Application/Properties/AssemblyInfo.cs

@ -0,0 +1,19 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Volo.Abp.Identity.Application")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("54592671-9cb6-48ae-9ae0-84cd016e87ff")]

20
src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.xproj

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>54592671-9cb6-48ae-9ae0-84cd016e87ff</ProjectGuid>
<RootNamespace>
</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

14
src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpIdentityApplicationModule.cs

@ -0,0 +1,14 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
namespace Volo.Abp.Identity
{
[DependsOn(typeof(AbpIdentityModule))]
public class AbpIdentityApplicationModule : AbpModule
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddAssemblyOf<AbpIdentityApplicationModule>();
}
}
}

60
src/Volo.Abp.Identity.Application/Volo/Abp/Identity/UserAppService.cs

@ -0,0 +1,60 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Application.Services.Dtos;
using Volo.Abp.Uow;
namespace Volo.Abp.Identity
{
public class UserAppService : IUserAppService
{
private readonly IIdentityUserRepository _userRepository;
private readonly IUnitOfWorkManager _unitOfWorkManager;
public UserAppService(
IIdentityUserRepository userRepository,
IUnitOfWorkManager unitOfWorkManager)
{
_userRepository = userRepository;
_unitOfWorkManager = unitOfWorkManager;
}
public async Task<ListResultDto<IdentityUserDto>> GetAll()
{
//Use conventional unit of work for application services when it's available!
using (var unitOfWork = _unitOfWorkManager.Begin())
{
var users = (await _userRepository.GetListAsync())
.Select(u => new IdentityUserDto
{
Id = u.Id,
Email = u.Email,
UserName = u.UserName
})
.ToList();
await unitOfWork.CompleteAsync();
return new ListResultDto<IdentityUserDto>(users);
}
}
public async Task<IdentityUserDto> Get(Guid id)
{
//Use conventional unit of work for application services when it's available!
using (var unitOfWork = _unitOfWorkManager.Begin())
{
var user = await _userRepository.GetAsync(id);
await unitOfWork.CompleteAsync();
return new IdentityUserDto
{
Id = user.Id,
UserName = user.UserName,
Email = user.Email
};
}
}
}
}

14
src/Volo.Abp.Identity.Application/project.json

@ -0,0 +1,14 @@
{
"version": "1.0.0-*",
"dependencies": {
"Volo.Abp.Identity": "1.0.0-*",
"Volo.Abp.Identity.Application.Contracts": "1.0.0-*"
},
"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
}
}

62
src/Volo.Abp.Identity.HttpApi.Host/AbpIdentityHttpApiHostModule.cs

@ -0,0 +1,62 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Volo.Abp.AspNetCore.Modularity;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.Modularity;
namespace Volo.Abp.Identity.HttpApi.Host
{
[DependsOn(typeof(AbpIdentityHttpApiModule), typeof(AbpIdentityEntityFrameworkCoreModule))]
public class AbpIdentityHttpApiHostModule : AbpModule
{
public override void ConfigureServices(IServiceCollection services)
{
var hostingEnvironment = services.GetSingletonInstance<IHostingEnvironment>();
var configuration = BuildConfiguration(hostingEnvironment);
services.Configure<DbConnectionOptions>(configuration);
services.Configure<AbpDbContextOptions>(options =>
{
//Configures all dbcontextes to use Sql Server with calculated connection string
options.Configure(context =>
{
context.DbContextOptions.UseSqlServer(context.ConnectionString);
});
});
services.AddMvc();
services.AddAssemblyOf<AbpIdentityHttpApiHostModule>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
context.GetLoggerFactory().AddConsole().AddDebug();
if (context.GetEnvironment().IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMvc(); //No need to a default route
}
private static IConfigurationRoot BuildConfiguration(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
return builder.Build();
}
}
}

20
src/Volo.Abp.Identity.HttpApi.Host/Program.cs

@ -0,0 +1,20 @@
using System.IO;
using Microsoft.AspNetCore.Hosting;
namespace Volo.Abp.Identity.HttpApi.Host
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}

27
src/Volo.Abp.Identity.HttpApi.Host/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:63290/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.Identity.HttpApi.Host": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

23
src/Volo.Abp.Identity.HttpApi.Host/Startup.cs

@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Volo.Abp.Identity.HttpApi.Host
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<AbpIdentityHttpApiHostModule>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.InitializeApplication();
}
}
}

25
src/Volo.Abp.Identity.HttpApi.Host/Volo.Abp.Identity.HttpApi.Host.xproj

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>eb902d57-c047-4cdf-828b-fdc204ac7398</ProjectGuid>
<RootNamespace>Volo.Abp.Identity.HttpApi.Host</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<DnxInvisibleContent Include="bower.json" />
<DnxInvisibleContent Include=".bowerrc" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

5
src/Volo.Abp.Identity.HttpApi.Host/appsettings.Staging.json

@ -0,0 +1,5 @@
{
"ConnectionStrings": {
"Default": "Server=192.168.1.36;Database=AbpDesk;User=sa;Password=123qwe;"
}
}

5
src/Volo.Abp.Identity.HttpApi.Host/appsettings.json

@ -0,0 +1,5 @@
{
"ConnectionStrings": {
"Default": "Server=localhost;Database=AbpDesk;Trusted_Connection=True;"
}
}

60
src/Volo.Abp.Identity.HttpApi.Host/project.json

@ -0,0 +1,60 @@
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.1.0",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools": {
"type": "build",
"version": "1.1.0-preview4-final"
},
"Volo.Abp.Identity.EntityFrameworkCore": "1.0.0-*",
"Volo.Abp.Identity.HttpApi": "1.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final"
},
"frameworks": {
"netcoreapp1.1": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"web.config",
"appsettings.json"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}

14
src/Volo.Abp.Identity.HttpApi.Host/web.config

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>

19
src/Volo.Abp.Identity.HttpApi/Properties/AssemblyInfo.cs

@ -0,0 +1,19 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Volo.Abp.Identity.HttpApi")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("57fca6cb-9d99-411e-8abf-20acfbd61d61")]

20
src/Volo.Abp.Identity.HttpApi/Volo.Abp.Identity.HttpApi.xproj

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>57fca6cb-9d99-411e-8abf-20acfbd61d61</ProjectGuid>
<RootNamespace>
</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

15
src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/AbpIdentityHttpApiModule.cs

@ -0,0 +1,15 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Modularity;
namespace Volo.Abp.Identity
{
[DependsOn(typeof(AbpIdentityApplicationModule), typeof(AbpAspNetCoreMvcModule))]
public class AbpIdentityHttpApiModule : AbpModule
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddAssemblyOf<AbpIdentityApplicationModule>();
}
}
}

33
src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUsersController.cs

@ -0,0 +1,33 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Services.Dtos;
using Volo.Abp.AspNetCore.Mvc;
namespace Volo.Abp.Identity
{
[Route("api/identity/users")]
public class IdentityUsersController : AbpController
{
private readonly IUserAppService _userAppService;
public IdentityUsersController(IUserAppService userAppService)
{
_userAppService = userAppService;
}
[HttpGet]
[Route("")]
public Task<ListResultDto<IdentityUserDto>> GetAll()
{
return _userAppService.GetAll();
}
[HttpGet]
[Route("{id}")]
public Task<IdentityUserDto> Get(Guid id)
{
return _userAppService.Get(id);
}
}
}

14
src/Volo.Abp.Identity.HttpApi/project.json

@ -0,0 +1,14 @@
{
"version": "1.0.0-*",
"dependencies": {
"Volo.Abp.AspNetCore.Mvc": "1.0.0-*",
"Volo.Abp.Identity.Application": "1.0.0-*"
},
"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
}
}

1
src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUser.cs

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.Linq;
using System.Security.Claims;

6
src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
@ -38,6 +39,11 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
//TODO: Override other methods?
public override async Task<List<TEntity>> GetListAsync(CancellationToken cancellationToken = new CancellationToken())
{
return await (await Collection.FindAsync(Builders<TEntity>.Filter.Empty, cancellationToken: cancellationToken)).ToListAsync(cancellationToken);
}
public override async Task<TEntity> GetAsync(TPrimaryKey id, CancellationToken cancellationToken = default(CancellationToken))
{
var entity = await FindAsync(id, cancellationToken);

23
src/Volo.Abp/Volo/Abp/Application/Services/Dtos/EntityDto.cs

@ -1,5 +1,28 @@
using System;
namespace Volo.Abp.Application.Services.Dtos
{
public class EntityDto : EntityDto<Guid>, IEntityDto
{
/// <summary>
/// Creates a new <see cref="EntityDto"/> object.
/// </summary>
public EntityDto()
{
}
/// <summary>
/// Creates a new <see cref="EntityDto"/> object.
/// </summary>
/// <param name="id">Id of the entity</param>
public EntityDto(Guid id)
: base(id)
{
}
}
/// <summary>
/// Implements common properties for entity based DTOs.
/// </summary>

16
src/Volo.Abp/Volo/Abp/Application/Services/Dtos/IEntityDto.cs

@ -1,12 +1,14 @@
namespace Volo.Abp.Application.Services.Dtos
using System;
namespace Volo.Abp.Application.Services.Dtos
{
///// <summary>
///// A shortcut of <see cref="IEntityDto{TPrimaryKey}"/> for most used primary key type (<see cref="int"/>).
///// </summary>
//public interface IEntityDto : IEntityDto<int>
//{
/// <summary>
/// A shortcut of <see cref="IEntityDto{TPrimaryKey}"/> for default primary key type (<see cref="Guid"/>).
/// </summary>
public interface IEntityDto : IEntityDto<Guid>
{
//}
}
/// <summary>
/// Defines common properties for entity based DTOs.

14
src/Volo.Abp/Volo/Abp/Domain/Repositories/IRepository.cs

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
@ -21,6 +22,19 @@ namespace Volo.Abp.Domain.Repositories
public interface IRepository<TEntity, TPrimaryKey> : IRepository
where TEntity : class, IEntity<TPrimaryKey>
{
/// <summary>
/// Get list of all entities without any filtering.
/// </summary>
/// <returns>List of entities</returns>
List<TEntity> GetList();
/// <summary>
/// Get list of all entities without any filtering.
/// </summary>
/// <param name="cancellationToken">A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.</param>
/// <returns>List of entities</returns>
Task<List<TEntity>> GetListAsync(CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Gets an entity with given primary key.
/// Throws <see cref="EntityNotFoundException"/> if can not find an entity with given id.

5
src/Volo.Abp/Volo/Abp/Domain/Repositories/QueryableRepositoryBase.cs

@ -36,6 +36,11 @@ namespace Volo.Abp.Domain.Repositories
protected abstract IQueryable<TEntity> GetQueryable();
public override List<TEntity> GetList()
{
return GetQueryable().ToList();
}
public override TEntity Find(TPrimaryKey id)
{
return GetQueryable().FirstOrDefault(CreateEqualityExpressionForId(id));

8
src/Volo.Abp/Volo/Abp/Domain/Repositories/RepositoryBase.cs

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
@ -15,6 +16,13 @@ namespace Volo.Abp.Domain.Repositories
public abstract class RepositoryBase<TEntity, TPrimaryKey> : IRepository<TEntity, TPrimaryKey>
where TEntity : class, IEntity<TPrimaryKey>
{
public abstract List<TEntity> GetList();
public virtual Task<List<TEntity>> GetListAsync(CancellationToken cancellationToken = new CancellationToken())
{
return Task.FromResult(GetList());
}
public virtual TEntity Get(TPrimaryKey id)
{
var entity = Find(id);

5
test/Volo.Abp.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs

@ -164,6 +164,11 @@ namespace Volo.Abp.Domain.Repositories
{
throw new NotImplementedException();
}
public override List<TEntity> GetList()
{
throw new NotImplementedException();
}
}
public class MyTestAggregateRootWithDefaultPkCustomRepository : MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>

Loading…
Cancel
Save