掲示板

How to write a Filter which executes only after AutoLoginHooks

9年前 に Muhammad Taha によって更新されました。

How to write a Filter which executes only after AutoLoginHooks

Junior Member 投稿: 63 参加年月日: 12/05/01 最新の投稿
Hi,

I have to write a filter (MyCustomFilter.java) which should execute only after AutoLoginHooks (MyAutoLoginHooks.java). I tried to do it as below. but the filter MyCustomFilter.java executing before MyAutoLoginHooks.java.

my liferay-hook.xml

<servlet-filter>
<servlet-filter-name>My Custom Filter</servlet-filter-name>
<servlet-filter-impl>com.mycomplany.MyCustomFilter</servlet-filter-impl>
<init-param>
<param-name>url-regex-ignore-pattern</param-name>
<param-value>^/html/.+\.(css|gif|html|ico|jpg|js|png)(\?.*)?$</param-value>
</init-param>
</servlet-filter>

<servlet-filter-mapping>
<servlet-filter-name>My Custom Filter</servlet-filter-name>
<after-filter>Auto Login Filter</after-filter>
<url-pattern>/c/portal/fckeditor</url-pattern>
<url-pattern>/c/portal/login</url-pattern>
<url-pattern>/c/portal/render_portlet</url-pattern>
<url-pattern>/c/portal/update_password</url-pattern>
<url-pattern>/c/portal/update_reminder_query</url-pattern>
<url-pattern>/documents/*</url-pattern>
<url-pattern>/group/*</url-pattern>
<url-pattern>/user/*</url-pattern>
<url-pattern>/web/*</url-pattern>
<url-pattern>/widget/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</servlet-filter-mapping>

Thanks in Advance...
thumbnail
9年前 に Olaf Kock によって更新されました。

RE: How to write a Filter which executes only after AutoLoginHooks

Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
You mention MyAutoLoginHooks and MyCustomFilter, both obviously not Liferay standard filters. As you only give the configuration for one of your filters, it's unclear what you're asking for (to me).

You might want to give the configuration for both, or identify other conditions/chain positions to hook into with your filters.
9年前 に Muhammad Taha によって更新されました。

RE: How to write a Filter which executes only after AutoLoginHooks

Junior Member 投稿: 63 参加年月日: 12/05/01 最新の投稿
MyAutoLoginHooks is my site minder auto login hook class.

here is the configuration in portal.properties,
auto.login.hooks=path.to.my.autologinhook.MyAutoLoginHooks

it looks like MyAutoLoginHooks is an event triggered when the user not signed in and its gets required hearer from the request.
thumbnail
9年前 に Manish Jha によって更新されました。

RE: How to write a Filter which executes only after AutoLoginHooks (回答)

Junior Member 投稿: 50 参加年月日: 13/02/07 最新の投稿
you could add post login hook like as follows :

login.events.post=com.bbb.intranet.postloginHook

you will can then implement your login inside postloginHook. This could act as your filter.

The serveletfileter hook always executed before login.
9年前 に Muhammad Taha によって更新されました。

RE: How to write a Filter which executes only after AutoLoginHooks

Junior Member 投稿: 63 参加年月日: 12/05/01 最新の投稿
Manish Jha:

The serveletfileter hook always executed before login.


Yes Manish, Thanks for your valuable point. this is what happening with my custom servlet filter..

I have to execute some code on every request (after login). I think Post Login Hook executes only one time after login event.

for workaround in my servlet filter code I'm thinking to restrict the execution based on sign-in status

try {
user = PortalUtil.initUser(request);
}
catch (NoSuchUserException nsue) {
log.info("NoSuchUserException");
}

boolean signedIn = !user.isDefaultUser();