掲示板

How can Servlet Hook Filter is applied to Whole Portal ??

11年前 に Ravi Kiran によって更新されました。

How can Servlet Hook Filter is applied to Whole Portal ??

Junior Member 投稿: 98 参加年月日: 11/12/12 最新の投稿
I want to restrict my Portal accesses from being accessed from other locations other than inside my Organization
For this i have decided to go with Servlet Liferay Hook Filter concepts .


This way

public class GeoLocationBasedAccessFilter implements Filter
{
@Override
public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)throws IOException, ServletException {

if(condition)
{
Writer writer = arg1.getWriter();
writer.write("This website is not accessible from your Location");

}
else{
doFilter(arg0, arg1);
}
}



As this Hook is applied only to a Specific Portlet . My question is , how can be this applied to the whole Portal as this Hook is applied to only a specific Portlet ?
thumbnail
11年前 に Vitaliy Koshelenko によって更新されました。

RE: How can Servlet Hook Filter is applied to Whole Portal ??

Expert 投稿: 319 参加年月日: 11/03/25 最新の投稿
You can add this filter into /ROOT/WEB-INF/web.xml file:
<filter>
        	<filter-name>GeoLocationBasedAccessFilter</filter-name>
        	<filter-class>com.organization.filter.GeoLocationBasedAccessFilter</filter-class>
    	</filter>
    	<filter-mapping>
        	<filter-name>GeoLocationBasedAccessFilter</filter-name>
        	<url-pattern>/*</url-pattern>
	</filter-mapping>

and this filter will be applied for all the portal.
thumbnail
11年前 に David H Nebinger によって更新されました。

RE: How can Servlet Hook Filter is applied to Whole Portal ??

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Or liferay-web.xml if you're running EE...
11年前 に Ravi Kiran によって更新されました。

RE: How can Servlet Hook Filter is applied to Whole Portal ??

Junior Member 投稿: 98 参加年月日: 11/12/12 最新の投稿
Thank you very much , where should i keep this particular class (GeoLocationBasedAccessFilter) ?? Should this be the part of Hook ??
thumbnail
11年前 に David H Nebinger によって更新されました。

RE: How can Servlet Hook Filter is applied to Whole Portal ??

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Nope, it's part of the portal so the class must be either in ROOT/WEB-INF/lib or lib/ext.
thumbnail
11年前 に Hitoshi Ozawa によって更新されました。

RE: How can Servlet Hook Filter is applied to Whole Portal ??

Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
Have you seen the following page?

http://www.connect-sam.com/

But if you just want to limit access to be within your organization. why not just block access at the firewall? I usually have a web browser in front of liferay where I can just setup security.
11年前 に Ravi Kiran によって更新されました。

RE: How can Servlet Hook Filter is applied to Whole Portal ??

Junior Member 投稿: 98 参加年月日: 11/12/12 最新の投稿
I kept the class inside the WEB-INF classes folder . It worked . Thank you .