hi
Your application does not use Cookies as the primary authentication method, the above scheme will not work for you.
You're using the
Identity Server
to issue the token and useJwtBearer
to validate the token.You can try other solutions based on this.
https://github.com/IdentityServer/IdentityServer4/issues/736 https://stackoverflow.com/questions/56021219/concurrent-login-with-identity-server4
Hi,
i still dont understand, since my project is using Identity Server to issue token and use JwtBearer to validate the token, the above two links still related with the cookie but not Jwt, and where to customise the login/logout function? i cant find the code inside the project, sorry that i am really a big headache on this, pls guide me.
Regards, Jeffrey Khor
hi
Can you apply your code to a template project and share it with me? liming.ma@volosoft.com
Hi,
just sent, pls check your email ya, thanks in advance!!!
Regards, Jeffrey khor
Hi,
i managed to fix the error above as your suggested, but now, it still not disabling the concurrent user login issue, what do i missed?
Regards, Jeffrey Khor
Hi,
I have been following this link also: https://support.abp.io/QA/Questions/1023/How-to-prevent-ConCurrent-Users-from-logging-in-using-the-same-user-credentials
firstly, i put in the PreconfigureService under the HttpApi.Host module as below:
then i create another three object classes under the HttpApi.Host module also as below:
MyAbpClaimsPrincipalContributor.cs
MyAbpSecurityStampValidator.cs:
currently the issue is error: InvalidOperationException: only a single identity supported
pls correct me if i am wrong
Regards, Jeffrey Khor
Hi,
i had added the code below into the ConfigureService under HttpApiHostModule.cs, still not working:
Configure<SecurityStampValidatorOptions>(options => { options.ValidationInterval = TimeSpan.FromSeconds(10); });
and the revocation endpoint suggestion were no longer accessible, and how should i add the property to the User as suggested in one of the provided link above? coz i cant find any code regarding the User class or Identity Class. Sorry as i am a new learner of Abp framework.
Regards, Jeffrey Khor
Hi,
Below is my ABP details information:
ABP Framework version: v4.4.3
UI type: Angular
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): yes
i had tried following the AntiForgeryOptions documentation as below: https://docs.abp.io/en/abp/4.4/CSRF-Anti-Forgery#abpantiforgeryoptions
and i had put in according to the stated documentation as below:
but the XSRF-TOKEN HttpOnly still false and the Expires/Max-Age still 10 years as below:
what am i missed?
Regards, Jeffrey Khor
i had emailed you with the template project with the version 4.4.3, pls check ya, thanks in advance!!!
Regards, Jeffrey Khor
this is strange, i had tried on non ABP framework, no issue, and its working!!! only when with ABP framework causing issue
no error or any warning logs, below are files that i put in according to the tutorial:
startup.cs:
using AspNetCoreRateLimit;
//using AspNetCoreRateLimit.Redis;
using DevExpress.AspNetCore;
using DevExpress.AspNetCore.Reporting;
using DevExpress.AspNetCore.Reporting.QueryBuilder;
using DevExpress.AspNetCore.Reporting.ReportDesigner;
using DevExpress.AspNetCore.Reporting.WebDocumentViewer;
using DevExpress.XtraReports.Security;
using DevExpress.XtraReports.Services;
//using DevExpress.XtraReports.Web.Extensions;
//using DevExpress.XtraReports.Web.ReportDesigner.Services;
//using DevExpress.XtraReports.Web.WebDocumentViewer;
//using KMS.EntityFrameworkCore;
using KMS.HubConfig;
using KMS.Reports;
//using KMS.Services;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
//using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
//using StackExchange.Redis;
using System;
//using System.Collections.Generic;
//using Volo.Abp.Users;
namespace KMS
{
public class Startup
{
private readonly IConfiguration appConfiguration;
public Startup(IConfiguration _appConfiguration)
{
appConfiguration = _appConfiguration;
}
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<KMSHttpApiHostModule>();
//added
services.AddCors(options =>
{
options.AddPolicy("AllowAllHeaders",
builder =>
{
builder.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod();
});
});
//added
services.AddSignalR(options =>
{
options.EnableDetailedErrors = true;
});
//added
services.AddControllers();
services.AddOptions();
services.AddMemoryCache();
services.Configure<IpRateLimitOptions>(appConfiguration.GetSection("IpRateLimit"));
services.AddSingleton<IIpPolicyStore, MemoryCacheIpPolicyStore>();
services.AddSingleton<IRateLimitCounterStore, MemoryCacheRateLimitCounterStore>();
services.AddSingleton<IRateLimitConfiguration, RateLimitConfiguration>();
services.AddSingleton<IProcessingStrategy, AsyncKeyLockProcessingStrategy>();
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddInMemoryRateLimiting();
//services.AddHttpContextAccessor();
ScriptPermissionManager.GlobalInstance = new ScriptPermissionManager(ExecutionMode.Unrestricted);
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
app.InitializeApplication();
app.UseDevExpressControls();
//added
app.UseCors("AllowAllHeaders");
app.UseIpRateLimiting();
//added
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapHub<MyMessageHub>("/signalrkms");
});
DevExpress.XtraReports.Web.ClientControls.LoggerService.Initialize(ProcessException);
}
void ProcessException(Exception ex, string message)
{
// Log exceptions here. For instance:
System.Diagnostics.Debug.WriteLine("[{0}]: Exception occured. Message: '{1}'. Exception Details:\r\n{2}",
DateTime.Now, message, ex);
}
}
}
appsettings.json:
{
...
"IpRateLimit": {
"EnableEndpointRateLimiting": true,
"StackBlockedRequests": false,
"RealIPHeader": "X-Real-IP",
"ClientIdHeader": "X-ClientId",
"HttpStatusCode": 429,
"GeneralRules": [
{
"Endpoint": "*:/api/app/kiosks",
"Period": "30s",
"Limit": 1
}
]
}
}