0

I have a service using a method and I have actual method call also using it. can we differentiate between both in Aspect programming.

for eg.

public class AccountProcessorImpl implements AccountProcessor{

public Response calculateBalance(Account accountInfo){
//some implementaion
}
} 

@Path("account")
public class AccountService{
    @InjectParam
    AccountProcessor accountProcessor;
    public Response getBalance (Account accountInfo)
    {
        return accountProcessor.calculateBalance(accountInfo);
    }
}

I have included the method calculateBalance in my Aspect program to do some authentication(PointCut()). Now I want to use this method just as a method call. Now the method fails due to the authentication. so Can I differentiate some how? like do authentication only if its a Rest API call and no need authentication if its a method call

user1364861
  • 301
  • 1
  • 2
  • 16

1 Answers1

1

Assuming you have layers (web, service, etc.), you could put security on the web layer and not the service layer.

SergeyB
  • 9,478
  • 4
  • 33
  • 47