Base solution for your next web application

Activities of "enerjisauretim"

Hello there,

I executed both "yarn" and "npm run create-bundles" scripts. However, here is the screenshot of chrome errors. No requests get a 404 response from server btw.

Answer

Hi,

We are starting a new project, based on aspnetzero and will be using blazor for the frontend side.

Blazor looks promising actually. I am not sure whether we will be able to replace the web.host project with blazor or not.

Question

Hello there,

I just want to ask you about the Blazor part of your roadmap. I've read your previous answers but they seemed old to me.

Do you have any plans for Blazor in near future?

I found the problem; It resides to the fact that OpenIdConnecAuthProviderApi needs two claims to be properly set, one for user fullname and the other for email address. However, there are lots of bugs in that provider such as:

 Claim claim1 = validateTokenResult.Principal.Claims.FirstOrDefault<Claim>((Func<Claim, bool>) (c => c.Type == "name"));
      if (claim1 == null)
        throw new UserFriendlyException("name claim is missing !");
      Claim claim2 = validateTokenResult.Principal.Claims.First<Claim>((Func<Claim, bool>) (c => c.Type == "unique_name"));
      if (claim1 == null)
        throw new UserFriendlyException("unique_name claim is missing !");
      string[] strArray = claim1.Value.Split(' ', StringSplitOptions.None);
      return new ExternalAuthUserInfo()
      {
        Provider = "OpenIdConnect",
        ProviderKey = validateTokenResult.Token.Subject,
        Name = strArray[0],
        Surname = strArray.Length > 1 ? strArray[1] : strArray[0],
        EmailAddress = claim2.Value
      };

Claim1 for user fullname and claim2 is for email address. When email address claim is not found, Sequence Contains No Elements exception is being thrown instead of an UserFriendlyException. We spend 3 whole days to configure it according to Azure AD B2B OpenId authentication. You must improve documentation for us to understand where we can get authority, login url and other relevant parameters.

Final configuration is shown below:

    "OpenId": {
      "IsEnabled": "true",
      "ClientId": "{clientid}",
      "TenantId": "{tenantid}",
      "Authority": "https://login.microsoftonline.com/{tenantid}/v2.0",
      "LoginUrl": "https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",
      "ValidateIssuer": "false",
      "ClaimsMapping": [
        {
          "claim": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier",
          "key": "http://schemas.microsoft.com/identity/claims/objectidentifier"
        },
        {
          "claim" : "unique_name",
          "key": "preferred_username"
        }
      ]
    },

Hi there,

Today I upgraded to the latest version of the aspnetzero framework, to enable Office365 login support for our corporate Azure Active Directory domain. However, it is not working. I have searched a lot, but it seems I have to rewrite the MSAL.js usage in order to make it working accordingly.

Could you please take a look to our configuration? Here is the configuration file for OpenID:

`"OpenId": {
      "IsEnabled": "true",
      "ClientId": "a6f3e01c-5eeb-4cce-8fce-e8df964152f2",
      "Authority": "https://login.microsoftonline.com/a730caa6-12ef-4586-9f28-6cfc59c76a6a/",
      "LoginUrl": "https://login.microsoftonline.com/",
      "ValidateIssuer": "true",
      "ClaimsMapping": [
        {
          "claim": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier",
          "key": "http://schemas.microsoft.com/identity/claims/objectidentifier"
        }
      ]
    },`

From the Azure Portal, I created an app registration, took clientid (a6f..) and tenant ids (a730...). The button is visible,** but after any successful login, it redirects me to the office.com**, instead of my application. I first tried on localhost, then on our test address. None of them working.

Configuration.Modules.AbpAspNetCore().DefaultWrapResultAttribute is also get-only property, so that I am unable to override the existing filter. Configuration.Modules.AbpAspNetCore().DefaultWrapResultAttribute.WrapOnError is not a function, in which I can resolve a HttpContext and decide to return a wrapped result or not.

Can you provide an example for this scenario?

I've tried many ways to either remove AbpResultFilter and add my extended Filter class, or make this filter class working conditionally.

In startup.cs file, services.Configure<MvcOptions> and PostConfigure methods not working, so that i was not be able to modify filters accordingly.

Hello,

I can list our needs:

  1. AppPermissions: related lines gets duplicated on each regeneration of the entity. It must be prevented and also, I want to change the generated code, however, its template is probably hidden in the application
  2. CustomDtoMapper: requirement is the same with the first line
  3. I want to prevent overriding some files when a regeneration occurs. for example, we created a validator template and within the templateinfo.txt file, i want to prevent duplicate generation/overriding if the specified already exists.

These are the ones that I remember for the moment.

Hello there,

We almost edited all of your templates that are being used by RAD extension. However, there is no documentation about it. Is there a source code or any kind of documentation about the properties,conditions and everyting helpful that we can learn about the extension?

I found out that default implementation of AbpLoginManager does that, if an external login provider fails, it checks the user along with his password in our database. And if the password seems okay, it lets the user in: (which is an undesired behaviour for our case, we will probably throw an UserFriendlyException to prevent his login attempt on LDAP failure cases)

 protected virtual async Task<AbpLoginResult<TTenant, TUser>> LoginAsyncInternal(string userNameOrEmailAddress, string plainPassword, string tenancyName, bool shouldLockout)
        {
            if (userNameOrEmailAddress.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(userNameOrEmailAddress));
            }

            if (plainPassword.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(plainPassword));
            }

            //Get and check tenant
            TTenant tenant = null;
            using (UnitOfWorkManager.Current.SetTenantId(null))
            {
                if (!MultiTenancyConfig.IsEnabled)
                {
                    tenant = await GetDefaultTenantAsync();
                }
                else if (!string.IsNullOrWhiteSpace(tenancyName))
                {
                    tenant = await TenantRepository.FirstOrDefaultAsync(t => t.TenancyName == tenancyName);
                    if (tenant == null)
                    {
                        return new AbpLoginResult<TTenant, TUser>(AbpLoginResultType.InvalidTenancyName);
                    }

                    if (!tenant.IsActive)
                    {
                        return new AbpLoginResult<TTenant, TUser>(AbpLoginResultType.TenantIsNotActive, tenant);
                    }
                }
            }

            var tenantId = tenant == null ? (int?)null : tenant.Id;
            using (UnitOfWorkManager.Current.SetTenantId(tenantId))
            {
                await UserManager.InitializeOptionsAsync(tenantId);

                //TryLoginFromExternalAuthenticationSources method may create the user, that's why we are calling it before AbpUserStore.FindByNameOrEmailAsync
                var loggedInFromExternalSource = await TryLoginFromExternalAuthenticationSourcesAsync(userNameOrEmailAddress, plainPassword, tenant);

                var user = await UserManager.FindByNameOrEmailAsync(tenantId, userNameOrEmailAddress);
                if (user == null)
                {
                    return new AbpLoginResult<TTenant, TUser>(AbpLoginResultType.InvalidUserNameOrEmailAddress, tenant);
                }

                if (await UserManager.IsLockedOutAsync(user))
                {
                    return new AbpLoginResult<TTenant, TUser>(AbpLoginResultType.LockedOut, tenant, user);
                }

                if (!loggedInFromExternalSource)
                {
                    if (!await UserManager.CheckPasswordAsync(user, plainPassword))
                    {
                        if (shouldLockout)
                        {
                            if (await TryLockOutAsync(tenantId, user.Id))
                            {
                                return new AbpLoginResult<TTenant, TUser>(AbpLoginResultType.LockedOut, tenant, user);
                            }
                        }

                        return new AbpLoginResult<TTenant, TUser>(AbpLoginResultType.InvalidPassword, tenant, user);
                    }

                    await UserManager.ResetAccessFailedCountAsync(user);
                }

                return await CreateLoginResultAsync(user, tenant);
            }
        }
Showing 11 to 20 of 36 entries