1

I am keeping looking for an authencitation solution in java until I found AOP.

It seesm that the advise of the AOP can act as an interceptor of the required method executation. Which can be use or authentication and authorization.

And I have heard some solutions based on URL filtering, but IMO, the AOP is better since it will intercepte the logic rather then the request path.

Especially in an application which have multiple views like this:example,

we can use only one authentication module to hold the whole application through AOP, but if we use the URL filtering, we have to make another authentication module for the "Client GUI View".

This is my opinion, I am not sure if this is right, please figure it out if I miss something.

And BTW, is there a live exmaple about AOP with authentication(Spring AOP is better)?

hguser
  • 35,079
  • 54
  • 159
  • 293

1 Answers1

0

I don't think using AOP for authentication is a good idea.

You can use filters to check if an user is authenticated. Here you have an example of this: How to redirect to Login page when Session is expired in Java web application?

Another approach, you can make use of Spring Security. It is quite simple and handle login for you. This guy shows well simple examples: http://www.mkyong.com/spring-security/spring-security-form-login-example/

Community
  • 1
  • 1
Federico Piazza
  • 30,085
  • 15
  • 87
  • 123
  • Yes,I know the filter and Spring security, but as shown in the image, how about my application have both HTML view and Client GUI view? Then does the spring security can be used for the Client GUI? – hguser Feb 12 '14 at 00:16
  • Is the Client GUI a desktop application? – Federico Piazza Feb 12 '14 at 15:10
  • @hguser you could implement a login service and abstract your authentication layer. In that way you can handle multiple client logins – Federico Piazza Feb 12 '14 at 15:51