Base solution for your next web application

Activities of "billyteng"

HI @ismcagdas

I have already change access permission. Now you can download it. Please....

Thanks

Hi @ismcagdas

Thanks reply. I have already shared with [email protected] in google drive. Please look at it. Thanks

Hi @ismcagdas

I have sent email to [email protected] and google drive download link.

Thanks

Hi Zony,

I can't hear anything from you. Please....

Hi wizgod,

This ticket solved my problems . https://support.aspnetzero.com/QA/Questions/9972/Error-when-removing-table-prefix-in-v101. 1.Delete all migration files in the Migrations folder. 2.Regenerate a new migration. 3.Run the Migrator program.

I have alread sent the files to your [email protected]. Please check it.

Hi Zony, Thanks for your reply. I did your follow. But it's still null value. Not show "Hello World". Look my code.

In Application layer public class NameNgCoreApplicationModule : AbpModule { public override void PreInitialize() { //Adding authorization providers Configuration.Authorization.Providers.Add<AppAuthorizationProvider>();

        //Adding custom AutoMapper configuration
        Configuration.Modules.AbpAutoMapper().Configurators.Add(CustomDtoMapper.CreateMappings);

        //For CustomClaimFactory
        IocManager.IocContainer.Register(
        Component
            .For&lt;IUserClaimsPrincipalFactory&lt;User&gt;, CustomClaimFactory>()
            .LifestyleTransient()
            .IsDefault());
    }

    public override void Initialize()
    {
        IocManager.RegisterAssemblyByConvention(typeof(BEZNgCoreApplicationModule).GetAssembly());
    }
}

I created "CustomClaimFactory" class in NameNgCore.Core project.

public class CustomClaimFactory : AbpUserClaimsPrincipalFactory<User, Role> { private readonly IRepository<Guest, Guid> _guestRepository; private readonly IRepository<Reservation, Guid> _reservationRepository; private readonly IRepository<Room, Guid> _roomRepository;

    public CustomClaimFactory(AbpUserManager&lt;Role, User&gt; userManager,
    AbpRoleManager&lt;Role, User&gt; roleManager,
    IOptions&lt;IdentityOptions&gt; optionsAccessor,
    IRepository&lt;Guest, Guid&gt; guestRepository,
    IRepository&lt;Reservation, Guid&gt; reservationRepository,
    IRepository&lt;Room, Guid&gt; roomRepository

        ) : base(userManager,
    roleManager,
    optionsAccessor)
    {
        _guestRepository = guestRepository;
        _reservationRepository = reservationRepository;
        _roomRepository = roomRepository;
    }
    public override async Task&lt;ClaimsPrincipal&gt; CreateAsync(User user)
    {
        var claim = await base.CreateAsync(user);

        var resObj = (from res in _reservationRepository.GetAll()
                      join gs in _guestRepository.GetAll() on res.GuestKey equals gs.Id
                      join r in _roomRepository.GetAll() on res.RoomKey equals r.Id
                      where (res.Status == 1 || res.Status == 2) && (gs.EMail == user.EmailAddress || gs.LastName == user.UserName)
                      select new
                      {
                          DocNo = res.DocNo,
                          ReservationKey = res.Id,
                          GuestKey = gs.Id
                      }).FirstOrDefault();
         // resObj has value             
        if (resObj != null)
        {
            claim.Identities.First().AddClaim(new Claim("Application_DOCNO", "Hello World"));
          
        }           

        return claim;
    }
}

public interface IMyAppSession
{
    string DOCNO { get; }      
}

public class MyAppSession : ClaimsAbpSession, ITransientDependency,IMyAppSession { public MyAppSession( IPrincipalAccessor principalAccessor, IMultiTenancyConfig multiTenancy, ITenantResolver tenantResolver, IAmbientScopeProvider<SessionOverride> sessionOverrideScopeProvider) : base(principalAccessor, multiTenancy, tenantResolver, sessionOverrideScopeProvider) { } public string DOCNO { get {
var userDocClaim = PrincipalAccessor.Principal?.Claims.FirstOrDefault(c => c.Type == "Application_DOCNO"); if (userDocClaim == null || string.IsNullOrEmpty(userDocClaim?.Value)) { return null; }

            return userDocClaim.Value;                
        }

    }
 }
 
 This is TokenAuthController in NameNgCore.Web.Core project
 which  call store values
 
  public class TokenAuthController : NameNgCoreControllerBase
{
private readonly IUserClaimsPrincipalFactory&lt;User&gt; _iclaimsPrincipalFactory;
private readonly IMyAppSession _p;
public TokenAuthController(IMyAppSession p,
        IUserClaimsPrincipalFactory&lt;User&gt; iclaimsPrincipalFactory
)
{
 _p = p;
        _iclaimsPrincipalFactory = iclaimsPrincipalFactory;
}

 [HttpPost]
    public async Task&lt;AuthenticateResultModel&gt; Authenticate([FromBody] AuthenticateModel model)
    {
        your code ...ok....then.......
        var loginResult = await GetLoginResultAsync(
            model.UserNameOrEmailAddress,
            model.Password,
            GetTenancyNameOrNull()
        );
        ..........
         var refreshToken = CreateRefreshToken(await CreateJwtClaims(loginResult.Identity, loginResult.User,
            tokenType: TokenType.RefreshToken));
        var accessToken = CreateAccessToken(await CreateJwtClaims(loginResult.Identity, loginResult.User,
            refreshTokenKey: refreshToken.key));
            
        var claims = await _iclaimsPrincipalFactory.CreateAsync(loginResult.User);

        var d =_p.DOCNO ; // here value is null. Actually it must show "Hello World" 
        
        return new AuthenticateResultModel
        {
            AccessToken = accessToken,
            ExpireInSeconds = (int)_configuration.AccessTokenExpiration.TotalSeconds,
            RefreshToken = refreshToken.token,
            RefreshTokenExpireInSeconds = (int)_configuration.RefreshTokenExpiration.TotalSeconds,
            EncryptedAccessToken = GetEncryptedAccessToken(accessToken),
            TwoFactorRememberClientToken = twoFactorRememberClientToken,
            UserId = loginResult.User.Id,
            ReturnUrl = returnUrl
        };
    }
}

please help me..Is there anything path?

Hi ismcagdas ,

When will release 10.1 and this removing table prefix fix in 10.1 version?

Thanks

Hi ismcagdas,

Any suggestions for this problems ? We still cannot solve yet.

Thanks

Hi ismcagdas,

I added the services.AddDataProtection at web.host project's ConfigureServices and tested. Key file is generated to specific location and not working on Server. I still got same problems. Do I need to amend another class or any files? Please kindly advice.

Thanks

Showing 21 to 30 of 32 entries