Hi
We are glad that you solved your problem, good work.
Hi kansoftware
To enable both Okta and Auth0 for a single tenant in your multi-tenant application, you will need to customize the code, as the standard ASP.NET Zero implementation typically supports only one OpenID Connect provider per tenant.
Hi kansoftware
ExternalAuthenticationProvider structure in MVC is different from Angular. The GetExternalAuthenticationProvidersmethod in TokenAuthController
is used in Angular. In MVC, ExternalAuthConfiguration *WebMvcModule.cs
must also be configured. Configuration example: You can configure it according to your scenario by using the ConfigureExternalAuthProviders method in the *WebHostModule.cs
class in the *.Host
project. Or if you want to use it as Scheme, you can use the GetExternalAuthenticationSchemesAsync method in the SignInManager
class in the *.Core
project.
Hi SRTMDEV
This problem does not occur in the latest version. You can update your project to the latest versions, ASP .NET Zero v13.4.0 and ASP .NET Boilerplate packages v9.4.2. Or you can update ASP .NET Boilerplate packages to version v9.1.3 or later. Related issue
Hi hongbing.wang
Could you please repeat the following ForceLogout
[HttpPost]
[AbpAuthorize(AppPermissions.Pages_Administration_Users)]
public async Task<IActionResult> ForceLogout(int tenantId, long userId)
{
var user = await _userManager.FindByIdAsync(userId.ToString());
if (user == null)
{
return NotFound("User not found.");
}
// Update security stamp to invalidate user's current tokens
await _userManager.UpdateSecurityStampAsync(user);
// Delete tokens from AbpUserTokens repository
var userTokens = await _userTokenRepository.GetAllListAsync(t => t.UserId == userId);
foreach (var token in userTokens)
{
await _userTokenRepository.DeleteAsync(token);
}
// Clear SecurityStampKey cache
var securityStampCache = _cacheManager.GetCache(AppConsts.SecurityStampKey);
await securityStampCache.RemoveAsync(userId.ToString());
// Clear TokenValidityKey cache
var tokenValidityCache = _cacheManager.GetCache(AppConsts.TokenValidityKey);
await tokenValidityCache.RemoveAsync(userId.ToString());
// Clear RefreshTokenValidityKey cache
var refreshTokenValidityCache = _cacheManager.GetCache(AppConsts.RefreshTokenValidityKey);
await refreshTokenValidityCache.RemoveAsync(userId.ToString());
// Remove security stamp cache item for the user
await _securityStampHandler.RemoveSecurityStampCacheItem(tenantId, userId);
return Ok("User has been logged out.");
}
Hi @kansoftware
Where are you using the GetExternalAuthenticationProviders
method? When I call the default GetExternalAuthenticationProviders
method in the TokenAuthController under *Web.Core, data is returned as shown in the screenshot below. You may want to check the OpenId settings in appsettings.json again. Could you provide more details so I can reproduce this issue?
Hi Loizos
This blog post can help you with your request.
Hi amontalvo
Install the Microsoft.ApplicationInsights.AspNetCore
package in your project. Add the Instrumentation Key from your Azure Application Insights resource to the appsettings.json file. Application Insights by adding services.AddApplicationInsightsTelemetry() in the ConfigureServices method. Your existing ILogger setup will automatically send logs to Application Insights.
Example:
appsettings.json
{
"ApplicationInsights": {
"InstrumentationKey": "YOUR_INSTRUMENTATION_KEY"
}
}
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
//...
services.AddApplicationInsightsTelemetry(Configuration["ApplicationInsights:InstrumentationKey"]);
//...
}
You can configure it this way if you only want to send error logs
"Logging": {
"ApplicationInsights": {
"LogLevel": {
"Default": "Error"
}
}
},
Hi Bernard
Your payload contains nested objects like:
{
"Questions": {
"0.Text": "DDD",
"0.Type": "Radio",
"0.Answers": {
"0.Text": "DDD",
"1.Text": "DDDD"
}
}
}
But this isn't how ASP.NET Core expects lists (arrays) to be sent. It expects a structure like:
{
"Questions": [
{
"Text": "DDD",
"Type": "Radio",
"Answers": [
{ "Text": "DDD" },
{ "Text": "DDDD" }
]
}
]
}
In your case, Questions
should be a list of QuestionDto
, and Answers
should be a list of AnswerDto
.
Hi aiqbal
Thank you for the situation you mentioned. We have created an issue for this development, you can follow it here.