0

我正在拼命地尝试为我的 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 包。

谢谢。

4

2 回答 2

1

如果你想覆盖 Liferay 身份验证,你必须创建一个钩子组件来覆盖自定义登录。

它必须实现一个过滤器来拦截请求标头并更改门户用于登录的方法。

我希望这对你有用。

于 2016-10-04T09:16:42.443 回答
0

谢谢你的想法。我终于用钩子解决了这个问题。我基于 Liferay 的 Shibboleth 身份验证插件(参见 github)。它最初是在 maven 中构建的,但我设法将其转换为 ant 以便能够使用 Liferay Plugin SDK 环境。

于 2016-10-25T11:27:01.120 回答