com.EBS.Common.Application
1.6.7.48
dotnet add package com.EBS.Common.Application --version 1.6.7.48
NuGet\Install-Package com.EBS.Common.Application -Version 1.6.7.48
<PackageReference Include="com.EBS.Common.Application" Version="1.6.7.48" />
<PackageVersion Include="com.EBS.Common.Application" Version="1.6.7.48" />
<PackageReference Include="com.EBS.Common.Application" />
paket add com.EBS.Common.Application --version 1.6.7.48
#r "nuget: com.EBS.Common.Application, 1.6.7.48"
#:package com.EBS.Common.Application@1.6.7.48
#addin nuget:?package=com.EBS.Common.Application&version=1.6.7.48
#tool nuget:?package=com.EBS.Common.Application&version=1.6.7.48
EBS.Common
I.Configuration
1.application.json
{
"App": {
"SelfUrl": "https://xxx.xx",
"CorsOrigins":"AllowAll,https://xxx.xx",
"AppUrlOptions":{
"RedirectAllowedUrls":"https://xxx.xx,https://yyy.yy",
"Applications": {
"MVC": {
"RootUrl": "http://xx:8080",
"Urls": {
"Abp.Account.PasswordReset": "account/reset-password"
}
},
"Angular": {
"RootUrl": "http://xx:8080",
"Urls": {
"Abp.Account.PasswordReset": "account/reset-password"
}
}
},
},
"OpenIddictServerSetting": {
"IsEnableAutherServer": true,
"AccessTokenLifetime": 60,
"RefreshTokenLifetime": 20_160,
"SigningCertificate": {
"Path": "xxx\\SigningCertificate.pfx",
"Password": "anypass",
"DistinguishedName":"CN=EBS Signing Certificate",
"KeyStorageFlags": "MachineKeySet, PersistKeySet, Exportable",//X509KeyStorageFlags
"ExpireDay": 3_650,
"KeySizeInBits": 4_096
},
"EncryptionCertificate": {
"Path": "xxx\\EncryptionCertificate.pfx",
"Password": "anypass",
"DistinguishedName":"CN=EBS Encryption Certificate",
"KeyStorageFlags": "MachineKeySet, PersistKeySet, Exportable",//X509KeyStorageFlags
"ExpireDay": 3_650,
"KeySizeInBits": 4_096
}
}
},
"ConnectionStrings": {
"Encrypted.Default": "xxx",
"Encrypted.HangfireConnection": "xxx",
"Encrypted.connect-name": "xxx"
},
"Settings":{
"IsEnableHangfireServer": true,
"BackgroundJob":{
"IsEnable": true,
"JobPollPeriod": 30000,
"MaxJobFetchCount": 200
},
"MappedConnections": {
"connect-name":["map-name-1","map-name-2"]
},
"DistributedLock":{
"KeyPrefix":"EbsApplication"
},
"DistributedCache":{
"KeyPrefix":"EbsApplication"
},
"DataProtection":{
"ApplicationName":"ebsApplication",
"PersistKeys":"ebs-service-Protection-Keys",
"PathFolder": string?
},
"ForwardedHeadersOptions": {
"ForwardedHeaders": null, // Docker/k8s prefer= "XForwardedFor, XForwardedProto, XForwardedHost" => .well-known/openid-configuration.jwks_uri = https ; use "app.UseForwardedHeaders();"
"ClearKnownNetworksProxies":null// true => .well-known/openid-configuration.jwks_uri = https ; use "app.UseForwardedHeaders();"
},
"TokenX509MfaOption": {
"MaxTimeoutSecond": 90
}
},
"Redis":{
"IsEnabled": false,
"Encrypted.Configuration":"xxxxx", // or "Configuration"
"ApplicationName":"ebsApplication",
"IsSentinel": false,
"ServiceName": string?
},
"WebPages":{
"ButtonResourceName":"IShopEBS"
},
"Swagger": {
"IsActive": true,
"IsWithOAuth": true,
"LastIsAll": true,
"XmlFileName": "abc.xml",
"Scopes": {
"IShopEBS": "EBS API"
},
"Docs":{
"DocName1":{ // is Microsoft.OpenApi.Models.OpenApiInfo
"Title": "All Api"
}
}
},
"AuthServer":{
"SwaggerClientId":"SwaggerDev",
"Authority":"https://xxxx.com"
},
"Minio":{
"Endpoint":"xxx",
"AccessKey": "[Optional]",
"SecretKey": "[Optional]",
"HealthChecks": true,
"Secure": true,
"Encrypted.AccessKey": "[Optional]",
"Encrypted.SecretKey": "[Optional]"
},
"ApplicationFileOptions": {
"key": "value"
},
"Templates":{
"Items" :{
"key1":{
"StoreName": "abc"
}
}
},
"Integrations":{
"VMG":{
"BrandNameDefault":"EBS",
"ApiSendSMS":"https://api.brandsms.vn/api/SMSBrandname/SendSMS",
"Token":xxx,
"MaxLengthMessage": 612
}
}
}
II.Modules and Handlers
IdentityClientModule
{
"IdentityClients": {
"AuthSSO": {
"Authority": "https://localhost:44320",
"GrantType": "client_credentials",
"ClientId": "PortalToSSO",
"ClientSecret": "Vpa@2026!88x",
"Scope": "inter-remote",
"RequireHttps": false,
"MapInboundClaims": false,
//"IncludeUrls": null,
//"IgnoreUrls": null,
"PermissionPath": "https://localhost:44320/api/app/inter-remote/permission/{0}"
}
},
"IdentityClientEncrypt": {
"EncryptedMode": "Encryptedx2",
"Keys": [ "ClientId" ]
},
"RemoteServices": {
"ServiceA": {
"BaseUrl": "https://localhost:443xx",
"IdentityClient": "AuthSSO"
}
}
}
ConfigureAuthentication()
{
context.Services.AddAuthentication(...).AddIdentityClientJwtBearer();
}
- Service/method
[Authorize(AuthenticationSchemes = "AuthSSO", Policy = CommonPermissions.AuditLog)]
- AutoApi (optional)
PreConfigureServices()
{
//optional
context.Services.Configure<MvcOptions>(options =>
{
options.Conventions.Add(SsoAuthenticationConvention());
});
}
public class SsoAuthenticationConvention : Microsoft.AspNetCore.Mvc.ApplicationModels.IControllerModelConvention
{
public void Apply(ControllerModel controller)
{
// Chỉ controller thuộc namespace/package AuditLog
if (controller.ControllerType.FullName?.StartsWith(typeof(AuditLogService).FullName) ?? false)
{
var authorize1 = controller.Attributes.OfType<AuthorizeAttribute>().FirstOrDefault();
authorize1?.AuthenticationSchemes = "AuthSSO";
foreach (var action in controller.Actions)
{
var authorize = action.Attributes
.OfType<AuthorizeAttribute>()
.FirstOrDefault();
authorize?.AuthenticationSchemes = "AuthSSO";
}
}
}
}
OneDeviceSignInModule
Setting
{
"App": {
"OpenIddictServerSetting": {
"OneDevice": {
"IsEnableExchangeToken": true
}
}
}
}
EnableExchangeToken:
/*Create exchangeCode*/
POST: <sso-domain>/api/app/auth-profile/require-exchange-token
/*Change code->token*/
curl --location '<sso-domain>/connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'X-Urn-EToken-Exchange: <exchangeCode>' \
--data-urlencode 'grant_type=urn:ebs:token-exchange' \
--data-urlencode 'client_id=<....>' \
--data-urlencode 'scope=<.....>' \
--data-urlencode 'token_type_hint=e_exchange_code' \
--data-urlencode 'token=<exchangeCode>'
Use AttachTokens
Sử dụng để attach sso-id vào header request , không cần add access_token khi gọi api từ web/host đến authserver và service
- AuthServer DependsOn AttachTokenAuthServerModule
- Web/Host DependsOn AttachTokenServiceModule
RoleGuardEfCoreModule
Protect role.
- Config module
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpDbContextOptions>(options =>
{
options.Configure<AuthDbContext>(dbContextOptions =>
{
dbContextOptions.UseSqlServer().AddInterceptors(dbContextOptions.ServiceProvider.GetRequiredService<IdentityUserSaveChangesInterceptor>());
});
});
}
- Role Extra property
role.SetProperty(RoleGuardConsts.IsGuardExtrapropertyName,true);
CommonApplicationModule
Config redis, distributed cache, distributed lock, data protection, forwarded headers, token x509 mfa option...
CommonWebModule
Config swagger, authserver, cors...
DefaultHtml2PdfRenderModule
Generate Html → pdf, email body... Use IHtml2PdfRender, ISignHandler
- Set CertContainer
- Default Folder BankEncrypt
- Copy file in font to Environment.CurrentDirectory/Exports/Fonts
- Text-Template in ContentRootPath/Exports/host/text-template/<template-name>/<language>.html ; Default en.html
EBSMinioBlobModule
Store Blob on Minio
- Imp IFileStore
- Config IOptions<ContainerTypeDefaultOption>
GenerateEmailingHandler
Generate email body and attach file (pdf, excel, word...) to email
- Impl + Add Service: IEmailingStoreRepository
- Impl + Add service: IGenerateEmailingGetFileDataHandler
- context.Services.AddTransient<IGenerateEmailingHandler, GenerateEmailingHandler>();
MaskingModule
Setting:
{
"Masking": {
"Rules": [
{
"Service": "PROJECT.HostService.IdentityUserAppService",//Service fullname
"Method": "GetListAsync",//method name
"Properties": [
{
"Property": "Email",
"Type": "Email"
},
{
"Property": "PhoneNumber",
"Type": "Phone"
}
]
}
]
}
}
Code:
/*dto*/
public class MaskOutputDto : EntityDto<Guid>
{
[Mask(MaskType.Email)]
public string Email { get; set; } = null!;
[Mask(MaskType.IdentityNumber)]
public string TaxCode { get; set; } = null!;
[Mask(MaskType.IdentityNumber)]
public string OrgLeaderNumber { get; set; } = null!;
[Mask(MaskType.Phone)]
public string? Phonenumber { get; set; }
}
/*method*/
[MaskOutputActionFilter]
public Task<PagedResultDto<MaskOutputDto>> GetListAsync();
/*Service*/
[MaskOutputActionFilter]
public class YourService
{
}
EbsMailGunApiModule
Send mail via IEmailSender by MailGun provider. Config
curl -X 'POST' \
'https://<domain>/api/setting-management/emailing' \
-H 'Content-Type: application/json' \
-d '{
"smtpHost": "https://api.mailgun.net/<resource-url>",
"smtpUserName": "<username>",
"smtpPassword": "<pass>",
"defaultFromAddress": "yourmail@yourdomain.xxom"
}'
ZozoMailModule
Send mail via IEmailSender by Zozo provider. Setting:
{
"Integrations": {
"ZozoEmail": {
"TimeoutSeconds": 120
}
}
}
Config
curl -X 'POST' \
'https://<domain>/api/setting-management/emailing' \
-H 'Content-Type: application/json' \
-d '{
"smtpHost": "<api-url>",
"smtpPassword": "<api-token>",
"defaultFromAddress": "yourmail@yourdomain.com",
"defaultFromDisplayName": "<display-name>"
}'
EInvoiceVnptModule
Use e-Invoice by VNPT provider
IEInvoiceVnptHandler
GenerateCodeModule
Generate code (no-duplicate) for entity. Use
1. IGenerateCodeManager,
2. ICacheShowroomNameHandler
VMGSmsModule
Send sms via VMG provider
IVMGConnectHandler
ExportExcelWorker
Export data to excel file Use:
1. IExportExcelWorker
III.Services
TextTemplateDefinition
Use
1. IRepository<TextTemplateDefinition, Guid> repository,
2. IRepository<TextTemplateDefinitionHistory, Guid> repositoryHis,
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- com.EBS.Common.Application.Contracts (>= 1.6.7.48)
- com.EBS.Common.Domain (>= 1.6.7.48)
- CoreHtmlToImage (>= 1.0.6)
- DistributedLock.Redis (>= 1.0.2)
- EPPlus (>= 6.2.3)
- ExcelDataReader (>= 3.7.0)
- ExcelDataReader.DataSet (>= 3.7.0)
- ExcelDataReader.Mapping (>= 2.2.2)
- Hangfire.AspNetCore (>= 1.8.15)
- Hangfire.Core (>= 1.8.15)
- Hangfire.SqlServer (>= 1.8.15)
- HtmlAgilityPack (>= 1.11.48)
- itext7 (>= 7.1.15)
- itext7.pdfhtml (>= 3.0.4)
- iTextSharp (>= 5.5.13.3)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.4)
- Microsoft.AspNetCore.DataProtection.StackExchangeRedis (>= 7.0.1)
- Microsoft.Data.SqlClient (>= 7.0.0)
- Microsoft.EntityFrameworkCore (>= 8.0.11)
- Microsoft.EntityFrameworkCore.Relational (>= 7.0.3)
- MimeMapping (>= 3.1.0)
- Otp.NET (>= 1.4.1)
- Portable.BouncyCastle (>= 1.9.0)
- RestSharp (>= 112.1.0)
- Serilog.AspNetCore (>= 8.0.2)
- System.Linq.Dynamic.Core (>= 1.6.3)
- System.Runtime.Handles (>= 4.3.0)
- Volo.Abp.Account.Application (>= 8.3.3)
- Volo.Abp.AspNetCore.MultiTenancy (>= 8.3.3)
- Volo.Abp.AspNetCore.Mvc.UI.Bootstrap (>= 8.3.3)
- Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared (>= 8.3.3)
- Volo.Abp.AutoMapper (>= 8.3.3)
- Volo.Abp.BackgroundJobs (>= 8.3.3)
- Volo.Abp.BackgroundJobs.Domain (>= 8.3.3)
- Volo.Abp.BackgroundJobs.HangFire (>= 8.3.3)
- Volo.Abp.BlobStoring (>= 8.3.3)
- Volo.Abp.BlobStoring.FileSystem (>= 8.3.3)
- Volo.Abp.BlobStoring.Minio (>= 8.3.3)
- Volo.Abp.Caching.StackExchangeRedis (>= 8.3.3)
- Volo.Abp.Ddd.Application (>= 8.3.3)
- Volo.Abp.DistributedLocking (>= 8.3.3)
- Volo.Abp.DistributedLocking.Abstractions (>= 8.3.3)
- Volo.Abp.Emailing (>= 8.3.3)
- Volo.Abp.Http.Client.IdentityModel (>= 8.3.3)
- Volo.Abp.IdentityModel (>= 8.3.3)
- Volo.Abp.MongoDB (>= 8.3.3)
- Volo.Abp.RemoteServices (>= 8.3.3)
- Volo.Abp.Swashbuckle (>= 8.3.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
app common 4 all proj