Openfire: bypass openfire authentication when accessing Servlet

Source: Internet
Author: User

Suppose there are the following scenarios. When we develop a plug-in of which servlet access is allowed, if no authentication is required or there are other security mechanisms, instead of performing an authentication of each time, we can directly access the servlet. The code for bypassing authentication is as follows:

@ Overridepublic void initializeplugin (pluginmanager manager, file plugindirectory) {// access the servlet authcheckfilter of plugin directly by bypassing logon. addexclude ("fchatplugin/servlet");} @ overridepublic void destroyplugin () {// access the servlet authcheckfilter of plugin directly by bypassing logon. removeexclude ("fchatplugin/servlet ");}

 
The servlet configuration file for reference is as follows:

 

 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> 3 <web-app> 4     <servlet> 5         <servlet-class>com.demo.fchatPlugin.SafeServlet</servlet-class> 6         <servlet-name>SafeServlet</servlet-name> 7     </servlet> 8  9     <servlet-mapping>10         <servlet-name>SafeServlet</servlet-name>11         <url-pattern>/servlet</url-pattern>12     </servlet-mapping>13 </web-app>

Now you can directly access the address: http: // localhost: 9090/plugins/fchatplugin/Servlet

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.