Answer the question
In order to leave comments, you need to log in
What is the best way to add authorization to the site?
At certain points, it is required to check authorization or register new users in an application using servlets and tomcat.
What is the best way to move the application logic into a separate class, taking into account multithreading and the need to communicate with the base?
Answer the question
In order to leave comments, you need to log in
It is best to entrust the authorization to the container as well.
If you need to do everything yourself, then you can implement your own filter (by implementing the javax.servlet.Filter interface ), in which you can try to understand whether the user is authorized or not. Such a filter must be written in web.xml in the form
<filter>
<filter-name>requestInterceptor</filter-name>
<filter-class>com.example.RequestInterceptorFilter</filter-class>
</filter>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question