Activities of "ademaygun"

Hi liangshiwei, Thanks for your support!

Hi liangshiwei, If I write the example code exactly as below, it creates a user in the AbpUsers table. If I log in again with the same user through an external provider, this time the CreateExternalUserAsync method is not triggered. Your suggestion works and is effective, but it means that the method (CreateExternalUserAsync) will always check whether the user exists before being called

[ExposeServices(typeof(LoginModel))]
public class MyLoginModel : LoginModel
{
    protected virtual async Task<IdentityUser> CreateExternalUserAsync(ExternalLoginInfo info)
    {
        var user = await base.CreateExternalUserAsync(info);
    }
}

adding external Login provider :

private void ConfigureExternalProviders(ServiceConfigurationContext context, IConfiguration configuration)
    {
        context.Services.AddAuthentication()
 .AddOpenIdConnect("oidc", options =>
 {
     options.Authority = "https://localhost:44366/";
     options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]); ;
     options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
     options.ClientId = "Client1";
     options.ClientSecret = "mysecret";

     options.UsePkce = true;
     options.SaveTokens = true;
     options.GetClaimsFromUserInfoEndpoint = true;
     options.Scope.Add("role");
     options.Scope.Add("email");
     options.Scope.Add("phone");
     options.ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "sub");
 }
    );

Hi Liangshiwei,

Thank you for your response, I appreciate your answer and I understand it very well. However, it seems like a workaround solution. I want to override the place where the decision to trigger this method is made. Even if I override the CreateExternalUserAsync method, it will still attempt to find the user every time and not be able to find it

Hi, After a successful login from an external login provider, I want to manually check whether the user exists in my system and then when I find the appropriate user, log them into my system (especially for tenant users)

  • ABP Framework version: v5.3.3
  • UI Type: Angular
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace: No exception message
  • Steps to reproduce the issue:
  1. I want only external login to be enabled and all other login methods to be disabled in my Abp project. How can I achieve this?
  2. If the external login is successful, and the user is coming to my system for the first time, I want to perform some checks and custom updates. How can I achieve this? I couldn't determine if I need to implement coding similar to the this solution provided after my research.

Note : External login provider is an another Abp project

  • ABP Framework version: v5.3.3
  • UI Type: Angular
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:
  • A user logs in to the ABP application.
  • The admin deactivates this user.(on another browser or machine)

I want the logged-in and deactivated user to be unable to perform any actions in the application or to force log out when they click anywhere. Is there a way to achieve this?

  • ABP Framework version: v7.3.2
  • UI Type: Angular
  • Database System: EF Core (PostgreSQL
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace: No exception
  • Steps to reproduce the issue:

As expressed by the user @mgurer , the methods of the class we implemented from IAbpClaimsPrincipalContributor are not being triggered in the refresh token flow. Therefore, we created a class derived from MyPrepareAccessTokenPrincipal. However, within the HandleAsync, how can we use our repository class?

public ValueTask HandleAsync(OpenIddictServerEvents.ProcessSignInContext context)
    {
	    var identity = context.AccessTokenPrincipal?.Identities.FirstOrDefault();
		var userId = identity?.FindUserId();
		if (userId!=null)
		{
		  var user = userRepository.GetAsync(userId); //<-- HOW CAN I INJECT userRepository
		}
		
        return default;
    }

Hello Anjali_Musmade,

Thank you for your response. It was definitely helpful to see this question. However, if possible, resolving the issue at its source is always a better solution. I'm curious about the following:

Would using ArgumentException instead of BusinessException in the Check class called within the Entity be a preference or a necessity? Because before .NET 7, we couldn't perform dependency injection into entity classes. Therefore, was it a necessity to use exceptions of type ArgumentException in entity classes due to the inability to localize them, or was it a deliberate choice?

About 10 months ago, Halil İbrahim Kalkan published an impressive article. I would like to see the adaptation of the Abp Suite's entity and manager classes in accordance with this article.

  • ABP Framework version: v7.3.2
  • UI Type: Angular
  • Database System: EF Core
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

When I create an entity with Abp Suite, I notice that some length and not-null checks are being performed.

  1. Why is BusinessException not being thrown in checks made with the Check class, and instead ArgumentException/ArgumentNull exceptions are thrown? (I don't see any drawback to throwing a business exception in the domain layer)
  2. The relevant checks are being performed in the constructor, but the properties have accessible set accessors. There is also a gap here.

If you agree with what I've mentioned in both points, Abp Suite should generate more robust code and I expect a change in this regard.

Hi @maliming,

The code you provided worked, thank you very much for your support

Showing 21 to 30 of 88 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 19, 2024, 10:13