Base solution for your next web application

Activities of "eivanov"

Answer

Sorry, i'm wrong.

First token remains valid.

Nevertheless, is it the right way?

Question

Hi there!

I wrote backend with api based on ABP/ABPZero.

Next i want to develop mobile application, which can do some requests to API. Mobile app will not have auth functionality, but i want to create one user in my backend for internal authorize in mobile app . It's for security reason, i don't want to open my api methods for public access, only for authorized users. And mobile client should use this user for request api methods.

But api/Account/Authenticate returns different tokens on every request and if i auth from one mobile phone then auth from another, first token becomes invalid. So, i need to auth on every request...It's impossible of course.

So, should i write own method Authenticate, which will store token and expiration time in database and not generate token on every auth request with same credentials, but return stored from database?

Thanks, ismcagdas.

You have misunderstood me, perhaps I asked a bad questions. I'll try to describe my questions in more detail.

  1. I have my AppServices, which simple inherited from CrudAppService without overriding methods.
public class EmpAppService : CrudAppService<Emp, EmpDto, long, GetAllEmpsInput>, IEmpAppService
{
}

Also i have custom permissions for read, update, delete my entities Emp. Should i override all base class (CrudAppService) methods in my EmpAppService for setting AbpAuthorize("permission") attribute to Get, Update and other methods?

  1. EmpAppService inheritance
EmpAppService : CrudAppService : ApplicationService : AbpServiceBase

But i have a base class in my app services layer named MyProjectAppServiceBase .

MyProjectAppServiceBase : ApplicationService

This class defined various methods like GetCurrentUserAsync, GetCurrentTenantAsync and my common methods, which i want to use in EmpAppService, but i can't because EmpAppService is not descendant of the MyProjectAppServiceBase class.

Ok, i can create MyProjectCrudAppServiceBase

EmpAppService : MyProjectCrudAppServiceBase  : CrudAppService

and duplicate methods from MyProjectAppServiceBase, but it's not DRY :)

Hi there!

I have 2 questions about using CrudAppService:

  1. How can i use AbpAuthorizeattribute on CrudAppServiceclass? Overriding base methods is not good approach.
  2. How can i inherite CrudAppServiceclass from AppServiceBaseclass?

Hi there!

I have a model Country(title) and CountryAppService inherited from AsyncCrudAppService.

This service is fired from front app in some.js file. Base validation for my creating Dto(Required, MinLength..) work perfectly. But now i want to <ins>check duplicating on insert</ins> for the new country.

As i read about domain services, i should implement domain service CountryManager, inject IReposity<Country> into and implement InsertAsync method, where i can check duplicating and throw UserFreindlyException.

But my AppService don't know about my CountryManager, it's work with IReposity<Country>. I see 2 approaches for resolving this issue:

  1. Create CountryRepository, overriding InsertAsync method with CountryManager using. But i suppose this is bad way because of CountryManager use IReposity<Country> already.

  2. I can override InsertAsync method of my CountryAppService. Is this the right way or more graceful solution exists?

Showing 1 to 5 of 5 entries