Hello,
I am trying to add extra fields to IdentityUser with ModuleExtensionConfiguration. I succesfully added a Guid,string and an Enum Type. But the DateTime field I added does not appear on the add user modal. The label of the field is visible but input is not.
ObjectExtensionManager.Instance.Modules()
.ConfigureIdentity(identity =>
{
identity.ConfigureUser(user =>
{
user.AddOrUpdateProperty<Guid>( //property type: string
"CompanyId", //property name
property =>
{
//validation rules
property.UI.Lookup.Url = "/api/app/my-companies";
property.UI.Lookup.DisplayPropertyName = "name";
property.UI.Lookup.ValuePropertyName = "id";
//...other configurations for this property
}
);
user.AddOrUpdateProperty<string>( //property type: string
"TcNo", //property name
property =>
{
property.Validators.Add(context =>
{
var socialSecurityNumber = context.Value as string;
if (!socialSecurityNumber.IsNullOrEmpty() && !ValidateTc(socialSecurityNumber))
{
context.ValidationErrors.Add(
new ValidationResult(
"Geçersiz Tc Kimlik: " + socialSecurityNumber,
new[] { "SocialSecurityNumber" }
)
);
}
});
}
);
user.AddOrUpdateProperty<UserType>("UserType");
user.AddOrUpdateProperty<DateTime>("BirthDate");
});
});
user.AddOrUpdateProperty<UserType>("UserType"); user.AddOrUpdateProperty<DateTime>("BirthDate");
Thanks, Can Ercan
Hi
With the new version 4.4.3 when i create a new tenant with seperated db database is created but tables are not created. Only EFMigrationsHistory table is created. In the previous version when tenant is created the same way database is created with tables without a problem. The project is newly created and only 1 entity added from abp suite. I reproduced the problem several times.
When i update database from admin tenant page i got the following error:
2021-10-08 13:46:18.186 +03:00 [ERR] Invalid object name 'AbpUsers'.
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpUsers'.
at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__169_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func
4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable
1.AsyncEnumerator.MoveNextAsync()
at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable
1 asyncEnumerable, CancellationToken cancellationToken)
at Volo.Abp.Identity.EntityFrameworkCore.EfCoreIdentityUserRepository.FindByNormalizedUserNameAsync(String normalizedUserName, Boolean includeDetails, CancellationToken cancellationToken)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.Identity.IdentityDataSeeder.SeedAsync(String adminEmail, String adminPassword, Nullable
1 tenantId)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.Data.DataSeeder.SeedAsync(DataSeedContext context) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at TenantDbTest.Data.TenantDbTestTenantDatabaseMigrationHandler.MigrateAndSeedForTenantAsync(Guid tenantId, String adminEmail, String adminPassword) in E:\abp\TenantDbTest\aspnet-core\src\TenantDbTest.Domain\Data\TenantDbTestTenantDatabaseMigrationHandler.cs:line 115
ClientConnectionId:5045aae6-9a46-4e87-9aa7-7a0e35f4ebaf
Error Number:208,State:1,Class:16
2021-10-08 13:46:18.186 +03:00 [ERR] ---------- Exception Data ----------
HelpLink.ProdName = Microsoft SQL Server
HelpLink.ProdVer = 13.00.4259
HelpLink.EvtSrc = MSSQLServer
HelpLink.EvtID = 208
HelpLink.BaseHelpUrl = http://go.microsoft.com/fwlink
HelpLink.LinkId = 20476
Besides this error there is no other error in the logs.
Thanks, Can Ercan
I am trying to implement multitenancy. My app.settings and angular environment variables are like below
{ "App": { "SelfUrl": "https://pbxticketapi.azurewebsites.net", "AngularUrl": "https://merlinvoip.com", "CorsOrigins": "https://merlinvoip.com,https://.merlinvoip.com,https://dva.merlinvoip.com,https://pbxticketclient.azurewebsites.net", "RedirectAllowedUrls": "https://merlinvoip.com,https://.merlinvoip.com,https://dva.merlinvoip.com,https://pbxticketclient.azurewebsites.net" }, "Redis": { "Configuration": "127.0.0.1" }, "ConnectionStrings": { "Default": ";" }, "AuthServer": { "Authority": "https://pbxticketapi.azurewebsites.net", "RequireHttpsMetadata": "false", "SwaggerClientId": "TestApp2_Swagger", "SwaggerClientSecret": "1q2w3e*" }, "StringEncryption": { "DefaultPassPhrase": "rL1OCmPHd9IOQZ7w" }, "Settings": { "Volo.Abp.LeptonTheme.Style": "Style6", "Volo.Abp.LeptonTheme.Layout.MenuPlacement": "Left", "Volo.Abp.LeptonTheme.Layout.MenuStatus": "AlwaysOpened", "Volo.Abp.LeptonTheme.Layout.Boxed": "False" } }
import { Environment } from '@abp/ng.core';
const baseUrl = 'https://{0}.merlinvoip.com';
export const environment = { production: true, application: { baseUrl, name: 'TestApp2', }, oAuthConfig: { issuer: 'https://pbxticketapi.azurewebsites.net', redirectUri: baseUrl, clientId: 'TestApp2_App', responseType: 'code', scope: 'offline_access TestApp2', requireHttps: false }, apis: { default: { url: 'https://pbxticketapi.azurewebsites.net', rootNamespace: 'TestApp2', }, }, } as Environment;
I put the code
Configure<AbpTenantResolveOptions>(options => { options.AddDomainTenantResolver("{0}.merlinvoip.com"); });
to HttpApiHostModule/ConfigureServices
When i try to login with a subdomain like https://dva.merlinvoip.com when cliecked to login i get 500 error code. When i looked at the logs i found error:
Invalid client configuration for client TestApp2_App: AllowedCorsOrigins contains invalid origin: https://*.merlinvoip.com
I tried changing the IdentityServerClientCorsOrigins table value to https://{0}.merlinvoip.com it didn't work either. Only way i can make it work is changing the value to https://merlinvoip.com and login as host admin but then i can't resolve tenant with subdomain that way. And i can't login with subdomain because i get redirect uri error when i click login that way.
I must be able to user both https://merlinvoip.com as an host admin and https://dva.merlinvoip.com as a tenant. I have a tenant created in the database as dva.
How should i set the values to IdentityServerClientCorsOrigins and IdentityServerClientRedirectUris tables in the database?
Thanks, Can Ercan
Is there any way to get the environment variables from a json file? For example if our customer has decided to change their IP address or Domain name is there any way to change configuration without rebuilding the app and deploying the files again?
import { Environment } from '@abp/ng.core';
const baseUrl = 'http://192.168.16.55:4200';
export const environment = { production: true, application: { baseUrl, name: 'AppName', }, oAuthConfig: { issuer: 'https://192.168.16.55:44321', redirectUri: baseUrl, clientId: 'AppName_App', responseType: 'code', scope: 'offline_access AppName', requireHttps: false }, apis: { default: { url: 'https://192.168.16.55:44321', rootNamespace: 'AppName', }, }
} as Environment;
Thanks, Can Ercan
As I understand IdentityServer requires HTTPS connection. But when we are developing a local intranet solution this is problematic. Is there anyway to disable https requirement for identityserver? When we change the URLs in the appsettings files to http angular client can not access the identity server. Nothing happens when we click the login button. If https can't be disabled is there any alternative to IdentityServer we can use without access to source code?
Thanks, Can Ercan
When i try to host the HttpApi.Host as a Windows Service i can't reach the localhost page and get Http Error 500.
i installed Microsoft.Extensions.Hosting and Microsoft.AspNetCore.Hosting nuget packages Below is my Program.cs code:
public static int Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
#if DEBUG
.MinimumLevel.Debug()
#else
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
#if DEBUG
.WriteTo.Async(c => c.Console())
#endif
.CreateLogger();
try
{
Log.Information("Starting IPCDataApp.HttpApi.Host.");
CreateHostBuilder(args).Build().Run();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly!");
return 1;
}
finally
{
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup();
webBuilder.ConfigureKestrel(serverOptions =>
{
serverOptions.Limits.MaxConcurrentConnections = 100;
serverOptions.Limits.MaxConcurrentUpgradedConnections = 100;
serverOptions.Limits.MaxRequestBodySize = 30 \* 1024 \* 1024;
serverOptions.Limits.MinRequestBodyDataRate =
new MinDataRate(bytesPerSecond: 100,
gracePeriod: TimeSpan.FromSeconds(10));
serverOptions.Limits.MinResponseDataRate =
new MinDataRate(bytesPerSecond: 100,
gracePeriod: TimeSpan.FromSeconds(10));
serverOptions.Limits.KeepAliveTimeout =
TimeSpan.FromMinutes(2);
serverOptions.Limits.RequestHeadersTimeout =
TimeSpan.FromMinutes(1);
serverOptions.Listen(IPAddress.Any, 5050);
});
})
.UseAutofac()
.UseSerilog()
.UseWindowsService();
}
After i publish the app and create the windows service Service starts without a problem. But when i try to reach the website http:\localhost:5050 i get htpp error 500. I would be grateful if you can help with the proble,
F.Can Ercan, SW Developer Merlin Yazilim