Base solution for your next web application

Activities of "apti"

Hi @sedulen - Brian

I really appreciate for sparing time and writing well detailed solution. I will check and try to implement that.If anything goes wrong I will write again.

Thanks

@musa.demir

User clickes on link which is going to public page on my site, I get token from the URL and pass it to API as parametere. In the Api, I decode the hash and get required data from it.

That is simple api which accept a string as aparameter. What I am asking is how to rewrite whole process to make it more OOP.

   public async Task<PagedResultDto<DocumentSharedObject>> GetRelatedDocuments(string token, GetAllRelatedDocumentsInput input)
        {
            //validate token
            RentalApplicationApplicantFormToken parsedToken = new RentalApplicationApplicantFormToken();
            try
            {
                parsedToken = _aESEncryptionManager.ValidateAndParseToken(token);
            }
            catch (Exception)
            {
                throw new UserFriendlyException(400, L("InvalidToken"));
            }

            //set tenant Id
            using (_unitOfWorkManager.Current.SetTenantId(parsedToken.TenantId))
            {
                  //Continue         
            }
        }

Actually my question is for writing better code based on Zero logic.

  1. How can I send that token (or any data) to back-end as http header?
    • Zero use nswag so service proxy is auto generated, I am not able to add any thing to header of request.
  2. How can I get token in back-end and pass it to XXXPublicAppServiceBase.
    • In AppService I don't have access to HttpRequest

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? 10.4.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)?.net core

Hello I need to give access to some api anonymous access, but not toatly anonymous, I am sending a custom hashed token to end-user's email. When user visits that link I can get that token and send it as parameter to my [AbpAllowAnonymous] api and encode the token and check if it's really my token or not and then process the other steps, everything works as ecpected.

But there are lots of api which are going to work in the same with that token and each time I should send it as parameter to api.

I am trying to write a public app service base and then all others public app serivce will inherit from this.

     /// <summary>
    /// Public App Service base
    /// </summary>
    public abstract class XXXPublicAppServiceBase : AbpServiceBase
    {
        public string Token { get; set; }

        protected XXXPublicAppServiceBase()
        {
            LocalizationSourceName = XXXConsts.LocalizationSourceName;
        }


        protected virtual void CheckErrors(IdentityResult identityResult)
        {
            identityResult.CheckErrors(LocalizationManager);
        }
    }

I have two question:

  1. How can I send that token to back-end as http header?
  2. How can I get token in back-end and pass it to XXXPublicAppServiceBase
Showing 1 to 3 of 3 entries