Skip to content

Commit

Permalink
Remodeling the project to avoid complexity, leaving only the API that…
Browse files Browse the repository at this point in the history
… will be responsible for creating usernames, authenticating, generating tokens, in the future if necessary we can divide it into more projects
  • Loading branch information
RondineleG committed Sep 14, 2023
1 parent 005fa16 commit d05afe6
Show file tree
Hide file tree
Showing 34 changed files with 1,037 additions and 458 deletions.
7 changes: 0 additions & 7 deletions Browl.sln
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FakeData", "FakeData", "{36
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Browl.Service.AuthSecurity", "Browl.Service.AuthSecurity", "{09EE67D6-ADE1-4A0A-8766-974D00A71209}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Browl.Service.AuthSecurity.Domain", "src\Services\Browl.Service.AuthSecurity\Browl.Service.AuthSecurity.Domain\Browl.Service.AuthSecurity.Domain.csproj", "{876B2511-5E72-4AE3-89E7-7B5DD327449B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Browl.Service.AuthSecurity.API", "src\Services\Browl.Service.AuthSecurity\Browl.Service.AuthSecurity.API\Browl.Service.AuthSecurity.API.csproj", "{051A7F26-D824-420B-B642-741C6CD41F13}"
EndProject
Global
Expand Down Expand Up @@ -144,10 +142,6 @@ Global
{7A01F807-7685-48FB-BAD0-9303E96A53B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A01F807-7685-48FB-BAD0-9303E96A53B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A01F807-7685-48FB-BAD0-9303E96A53B5}.Release|Any CPU.Build.0 = Release|Any CPU
{876B2511-5E72-4AE3-89E7-7B5DD327449B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{876B2511-5E72-4AE3-89E7-7B5DD327449B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{876B2511-5E72-4AE3-89E7-7B5DD327449B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{876B2511-5E72-4AE3-89E7-7B5DD327449B}.Release|Any CPU.Build.0 = Release|Any CPU
{051A7F26-D824-420B-B642-741C6CD41F13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{051A7F26-D824-420B-B642-741C6CD41F13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{051A7F26-D824-420B-B642-741C6CD41F13}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -179,7 +173,6 @@ Global
{7A01F807-7685-48FB-BAD0-9303E96A53B5} = {361920A2-8B95-47B1-AA42-C9ADD6D28D23}
{361920A2-8B95-47B1-AA42-C9ADD6D28D23} = {DB8F8AA6-A0F4-487D-B807-787C5117DD35}
{09EE67D6-ADE1-4A0A-8766-974D00A71209} = {758EAD6C-01B5-4816-97E5-CA0E5F217D34}
{876B2511-5E72-4AE3-89E7-7B5DD327449B} = {09EE67D6-ADE1-4A0A-8766-974D00A71209}
{051A7F26-D824-420B-B642-741C6CD41F13} = {09EE67D6-ADE1-4A0A-8766-974D00A71209}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.32.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Browl.Service.AuthSecurity.Domain\Browl.Service.AuthSecurity.Domain.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Browl.Service.AuthSecurity.API.Data;
using Browl.Service.AuthSecurity.Domain.Entities;

using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
Expand All @@ -11,10 +12,11 @@ public static class DatabaseConfig
public static IServiceCollection AddDatabaseConfiguration(this IServiceCollection services, IConfiguration configuration)
{
services.AddDbContext<BrowlAuthSecurityDbContext>(options => options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<BrowlAuthSecurityDbContext, IdentityRole>()
.AddEntityFrameworkStores<BrowlAuthSecurityDbContext>()
.AddDefaultUI()
.AddDefaultTokenProviders();

services.AddIdentity<User, IdentityRole>()
.AddEntityFrameworkStores<BrowlAuthSecurityDbContext>()
.AddDefaultUI()
.AddDefaultTokenProviders();

return services;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Browl.Service.AuthSecurity.API.Data;
using Browl.Service.AuthSecurity.Domain.Extensions;
using Browl.Service.AuthSecurity.API.Entities;

using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Identity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using Browl.Service.AuthSecurity.Domain.Entities;
using Browl.Service.AuthSecurity.Domain.Extensions;

using Browl.Service.AuthSecurity.API.Entities;
using Browl.Service.AuthSecurity.Domain.Entities;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;

using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;

namespace Browl.Service.AuthSecurity.API.Controllers;

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,46 +1,15 @@
using Browl.Service.AuthSecurity.Domain.Entities;

using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace Browl.Service.AuthSecurity.API.Data;

public class BrowlAuthSecurityDbContext : IdentityDbContext<User>
{
public BrowlAuthSecurityDbContext(DbContextOptions<BrowlAuthSecurityDbContext> options) : base(options) { }

protected override void OnModelCreating(ModelBuilder builder)
{
public BrowlAuthSecurityDbContext(DbContextOptions<BrowlAuthSecurityDbContext> options) : base(options)
{
base.OnModelCreating(builder);
builder.HasDefaultSchema("Identity");
builder.Entity<IdentityUser>(entity =>
{
entity.ToTable(name: "User");
});
builder.Entity<IdentityRole>(entity =>
{
entity.ToTable(name: "Role");
});
builder.Entity<IdentityUserRole<string>>(entity =>
{
entity.ToTable("UserRoles");
});
builder.Entity<IdentityUserClaim<string>>(entity =>
{
entity.ToTable("UserClaims");
});
builder.Entity<IdentityUserLogin<string>>(entity =>
{
entity.ToTable("UserLogins");
});
builder.Entity<IdentityRoleClaim<string>>(entity =>
{
entity.ToTable("RoleClaims");
});
builder.Entity<IdentityUserToken<string>>(entity =>
{
entity.ToTable("UserTokens");
});
}
}


This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit d05afe6

Please sign in to comment.