Compare commits

...

5 Commits

17 changed files with 35 additions and 31 deletions

View File

@@ -32,8 +32,7 @@ try
builder.Services.AddDbContext<WFDBContext>(options => options.UseSqlServer(cnn_str).EnableDetailedErrors()); builder.Services.AddDbContext<WFDBContext>(options => options.UseSqlServer(cnn_str).EnableDetailedErrors());
builder.Services.AddWorkFlow().AddUserManager<WFDBContext>(); builder.Services.AddWorkFlow().AddUserManager<WFDBContext>();
builder.Services.AddCookieBasedLocalizer(); builder.Services.AddCookieBasedLocalizer();
builder.ConfigureBySection<DirectorySearchOptions>(); builder.Services.AddDirectorySearchService(config.GetSection("DirectorySearchOptions"));
builder.Services.AddDirectorySearchService();
builder.Services.AddJWTService<UserReadDto>(user => new SecurityTokenDescriptor() builder.Services.AddJWTService<UserReadDto>(user => new SecurityTokenDescriptor()
{ {
Claims = user.ToClaimList().ToDictionary(claim => claim.Type, claim => claim.Value as object) Claims = user.ToClaimList().ToDictionary(claim => claim.Type, claim => claim.Value as object)
@@ -48,12 +47,10 @@ try
else else
throw new("The API Key Authorization configuration is not available in the app settings, even though the app is not in development or DiP mode and API Key Authorization is not disabled."); throw new("The API Key Authorization configuration is not available in the app settings, even though the app is not in development or DiP mode and API Key Authorization is not disabled.");
// Created separately from AuthClientParams (added via options) for use in Jwt Bearer configuration
var authPublicKey = config.GetSection("AuthPublicKey").Get<ClientPublicKey>() ?? throw new InvalidOperationException("The AuthPublicKey configuration is missing or invalid."); var authPublicKey = config.GetSection("AuthPublicKey").Get<ClientPublicKey>() ?? throw new InvalidOperationException("The AuthPublicKey configuration is missing or invalid.");
builder.Services.AddAuthHubClient(config, opt => builder.Services.AddAuthHubClient(config.GetSection("AuthClientParams"), opt => opt.PublicKeys.Add(authPublicKey));
{
opt.PublicKeys.Add(authPublicKey);
});
builder.Services.AddControllers(); builder.Services.AddControllers();
@@ -66,7 +63,11 @@ try
IssuerSigningKeyResolver = (token, securityToken, identifier, parameters) => IssuerSigningKeyResolver = (token, securityToken, identifier, parameters) =>
{ {
return [authPublicKey.SecurityKey]; return [authPublicKey.SecurityKey];
} },
ValidateIssuer = true,
ValidIssuer = authPublicKey.Issuer,
ValidateAudience = true,
ValidAudience = authPublicKey.Audience
}; };
}); });

View File

@@ -12,8 +12,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DigitalData.Auth.Client" Version="1.1.4.1" /> <PackageReference Include="DigitalData.Auth.Client" Version="1.1.5" />
<PackageReference Include="DigitalData.Core.API" Version="2.0.0" /> <PackageReference Include="DigitalData.Core.API" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.13" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.13" />
<PackageReference Include="NLog" Version="5.3.4" /> <PackageReference Include="NLog" Version="5.3.4" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.14" /> <PackageReference Include="NLog.Web.AspNetCore" Version="5.3.14" />

View File

@@ -11,8 +11,8 @@
"NLog": { "NLog": {
"throwConfigExceptions": true, "throwConfigExceptions": true,
"variables": { "variables": {
"logDirectory": "E:\\LogFiles\\Digital Data\\workFlow", "logDirectory": "E:\\LogFiles\\Digital Data\\workFlow.API",
"logFileNamePrefix": "${shortdate}-ECM.EnvelopeGenerator.Web" "logFileNamePrefix": "${shortdate}-workFlow.API"
}, },
"targets": { "targets": {
"infoLogs": { "infoLogs": {
@@ -78,7 +78,8 @@
} }
}, },
"AuthClientParams": { "AuthClientParams": {
"Url": "https://localhost:7192" "Url": "https://localhost:7192",
"PublicKeys": []
}, },
"AuthPublicKey": { "AuthPublicKey": {
"Issuer": "auth.digitaldata.works", "Issuer": "auth.digitaldata.works",

View File

@@ -4,7 +4,7 @@ using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts namespace WorkFlow.Application.Contracts
{ {
public interface IConfigService : ICRUDService<ConfigCreateDto, ConfigDto, ConfigUpdateDto, Config, int> public interface IConfigService : ICRUDService<ConfigCreateDto, ConfigDto, Config, int>
{ {
} }
} }

View File

@@ -5,7 +5,7 @@ using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts namespace WorkFlow.Application.Contracts
{ {
public interface IProfileControlsTFService : ICRUDService<ProfileControlsTFCreateDto, ProfileControlsTFDto, ProfileControlsTFUpdateDto, ProfileControlsTF, int> public interface IProfileControlsTFService : ICRUDService<ProfileControlsTFCreateDto, ProfileControlsTFDto, ProfileControlsTF, int>
{ {
Task<DataResult<IEnumerable<ProfileControlsTFDto>>> ReadAsync( Task<DataResult<IEnumerable<ProfileControlsTFDto>>> ReadAsync(
bool withProfile = true, bool withUser = false, bool withProfile = true, bool withUser = false,

View File

@@ -5,7 +5,7 @@ using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts namespace WorkFlow.Application.Contracts
{ {
public interface IProfileObjStateService : ICRUDService<ProfileObjStateCreateDto, ProfileObjStateDto, ProfileObjStateUpdateDto, ProfileObjState, int> public interface IProfileObjStateService : ICRUDService<ProfileObjStateCreateDto, ProfileObjStateDto, ProfileObjState, int>
{ {
Task<DataResult<IEnumerable<ProfileObjStateDto>>> ReadAsync( Task<DataResult<IEnumerable<ProfileObjStateDto>>> ReadAsync(
bool withProfile = true, bool withUser = true, bool withState = true, bool withProfile = true, bool withUser = true, bool withState = true,

View File

@@ -4,7 +4,7 @@ using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts namespace WorkFlow.Application.Contracts
{ {
public interface IProfileService : ICRUDService<ProfileCreateDto, ProfileDto, ProfileUpdateDto, Profile, int> public interface IProfileService : ICRUDService<ProfileCreateDto, ProfileDto, Profile, int>
{ {
} }
} }

View File

@@ -4,7 +4,7 @@ using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts namespace WorkFlow.Application.Contracts
{ {
public interface IStateService : ICRUDService<StateCreateDto, StateDto, StateUpdateDto, State, int> public interface IStateService : ICRUDService<StateCreateDto, StateDto, State, int>
{ {
} }
} }

View File

@@ -9,8 +9,8 @@ using WorkFlow.Infrastructure.Contracts;
namespace WorkFlow.Application.Services namespace WorkFlow.Application.Services
{ {
public class ConfigService(IConfigRepository repository, IMapper mapper) public class ConfigService(IConfigRepository repository, IMapper mapper)
: CRUDService<IConfigRepository, ConfigCreateDto, ConfigDto, ConfigUpdateDto, Config, int>(repository, mapper), : CRUDService<IConfigRepository, ConfigCreateDto, ConfigDto, Config, int>(repository, mapper),
IConfigService, ICRUDService<ConfigCreateDto, ConfigDto, ConfigUpdateDto, Config, int> IConfigService, ICRUDService<ConfigCreateDto, ConfigDto, Config, int>
{ {
} }
} }

View File

@@ -10,8 +10,8 @@ using WorkFlow.Infrastructure.Contracts;
namespace WorkFlow.Application.Services namespace WorkFlow.Application.Services
{ {
public class ProfileControlsTFService(IProfileControlsTFRepository repository, IMapper mapper) public class ProfileControlsTFService(IProfileControlsTFRepository repository, IMapper mapper)
: CRUDService<IProfileControlsTFRepository, ProfileControlsTFCreateDto, ProfileControlsTFDto, ProfileControlsTFUpdateDto, ProfileControlsTF, int>(repository, mapper), : CRUDService<IProfileControlsTFRepository, ProfileControlsTFCreateDto, ProfileControlsTFDto, ProfileControlsTF, int>(repository, mapper),
IProfileControlsTFService, ICRUDService<ProfileControlsTFCreateDto, ProfileControlsTFDto, ProfileControlsTFUpdateDto, ProfileControlsTF, int> IProfileControlsTFService, ICRUDService<ProfileControlsTFCreateDto, ProfileControlsTFDto, ProfileControlsTF, int>
{ {
public async Task<DataResult<IEnumerable<ProfileControlsTFDto>>> ReadAsync( public async Task<DataResult<IEnumerable<ProfileControlsTFDto>>> ReadAsync(
bool withProfile = true, bool withUser = false, bool withProfile = true, bool withUser = false,

View File

@@ -10,8 +10,8 @@ using WorkFlow.Infrastructure.Contracts;
namespace WorkFlow.Application.Services namespace WorkFlow.Application.Services
{ {
public class ProfileObjStateService(IProfileObjStateRepository repository, IMapper mapper) public class ProfileObjStateService(IProfileObjStateRepository repository, IMapper mapper)
: CRUDService<IProfileObjStateRepository, ProfileObjStateCreateDto, ProfileObjStateDto, ProfileObjStateUpdateDto, ProfileObjState, int>(repository, mapper), : CRUDService<IProfileObjStateRepository, ProfileObjStateCreateDto, ProfileObjStateDto, ProfileObjState, int>(repository, mapper),
IProfileObjStateService, ICRUDService<ProfileObjStateCreateDto, ProfileObjStateDto, ProfileObjStateUpdateDto, ProfileObjState, int> IProfileObjStateService, ICRUDService<ProfileObjStateCreateDto, ProfileObjStateDto, ProfileObjState, int>
{ {
public async Task<DataResult<IEnumerable<ProfileObjStateDto>>> ReadAsync( public async Task<DataResult<IEnumerable<ProfileObjStateDto>>> ReadAsync(
bool withProfile = true, bool withUser = true, bool withState = true, bool withProfile = true, bool withUser = true, bool withState = true,

View File

@@ -8,8 +8,8 @@ using WorkFlow.Infrastructure.Contracts;
namespace WorkFlow.Application.Services namespace WorkFlow.Application.Services
{ {
public class ProfileService(IProfileRepository repository, AutoMapper.IMapper mapper) public class ProfileService(IProfileRepository repository, AutoMapper.IMapper mapper)
: CRUDService<IProfileRepository, ProfileCreateDto, ProfileDto, ProfileUpdateDto, Profile, int>(repository, mapper), : CRUDService<IProfileRepository, ProfileCreateDto, ProfileDto, Profile, int>(repository, mapper),
IProfileService, ICRUDService<ProfileCreateDto, ProfileDto, ProfileUpdateDto, Profile, int> IProfileService, ICRUDService<ProfileCreateDto, ProfileDto, Profile, int>
{ {
} }
} }

View File

@@ -9,8 +9,8 @@ using WorkFlow.Infrastructure.Contracts;
namespace WorkFlow.Application.Services namespace WorkFlow.Application.Services
{ {
public class StateService(IStateRepository repository, IMapper mapper) public class StateService(IStateRepository repository, IMapper mapper)
: CRUDService<IStateRepository, StateCreateDto, StateDto, StateUpdateDto, State, int>(repository, mapper), : CRUDService<IStateRepository, StateCreateDto, StateDto, State, int>(repository, mapper),
IStateService, ICRUDService<StateCreateDto, StateDto, StateUpdateDto, State, int> IStateService, ICRUDService<StateCreateDto, StateDto, State, int>
{ {
} }
} }

View File

@@ -7,8 +7,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DigitalData.Core.Application" Version="2.0.0" /> <PackageReference Include="DigitalData.Core.Application" Version="3.2.0" />
<PackageReference Include="UserManager.Application" Version="2.0.0" /> <PackageReference Include="UserManager.Application" Version="3.1.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -7,7 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="UserManager.Domain" Version="2.0.0" /> <PackageReference Include="UserManager.Domain" Version="3.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -30,6 +30,8 @@ namespace WorkFlow.Infrastructure
public DbSet<UserRep> UserReps { get; set; } public DbSet<UserRep> UserReps { get; set; }
public DbSet<ClientUser> ClientUsers { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
//configure model builder for user manager tables //configure model builder for user manager tables

View File

@@ -8,7 +8,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.0.0" /> <PackageReference Include="DigitalData.Core.Infrastructure" Version="2.0.0" />
<PackageReference Include="UserManager.Infrastructure" Version="2.0.0" /> <PackageReference Include="UserManager.Infrastructure" Version="3.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>