我正在拼命地尝试为我的 liferay tomcat 包重现这里的示例:http: //liferay-blogging.blogspot.be/2011/08/how-to-change-liferay-login-module.html
我重新创建了作者的包和类:
package de.test.auth;
import java.util.Map;
import com.liferay.portal.security.auth.AuthException;
import com.liferay.portal.security.auth.Authenticator;
public class RefuseAuthenticator implements Authenticator {
public int authenticateByEmailAddress(long arg0, String arg1, String arg2, Map<String, String[]> arg3, Map<String, String[]> arg4) throws AuthException {
System.out.println("failed by mail");
return FAILURE;
}
public int authenticateByScreenName(long arg0, String arg1, String arg2, Map<String, String[]> arg3, Map<String, String[]> arg4) throws AuthException {
System.out.println("failed by screen name");
return FAILURE;
}
public int authenticateByUserId(long arg0, long arg1, String arg2, Map<String, String[]> arg3, Map<String, String[]> arg4) throws AuthException {
System.out.println("failed by user id");
return FAILURE;
}
}
我将包导出为 jar 文件,放在 LR-portal/TOMCAT/lib/ext 文件夹中
我添加了 2 行:
auth.pipeline.enable.liferay.check=false
auth.pipeline.pre=de.test.auth.RefuseAuthenticator
在位于 LR-portal/TOMCAT/webapps/ROOT/WEB-INF/lib/portlet_impl.jar 的标准 portal.properties 文件中。我知道它应该在一个portal-ext.properties 文件中,但它无论如何都不起作用,所以我消除了所有可能的副作用。
不幸的是,Liferay 继续正常记录我的用户。我阅读了关于在 Liferay 中执行自定义代码的钩子和 ext 方法,所以我可能会遗漏一些东西。在写到这里之前,我阅读了很多论坛帖子。
我正在使用 liferay-ce-portal-7.0-ga3 tomcat 包。
谢谢。