2016-10-03 56 views
0

我拼命想在这里重现例如我的Liferay的Tomcat软件包: http://liferay-blogging.blogspot.be/2011/08/how-to-change-liferay-login-module.html如何覆盖Liferay的认证

我已经重新笔者的包和类:

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; 
} 

} 

我导出包作为我放置在LR-门户/ TOMCAT/LIB/ext文件夹

jar文件我添加了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包。

谢谢。

+0

正如博客文章所示,尝试使用ext for this,并且在调试模式下使用sserver来验证在认证过程中到相应类的流 –

回答

0

感谢您的想法。 我终于绕过这个使用钩子。 我基于自己的Shibboleth身份验证插件的Liferay(请参阅github)。它最初是在maven中构建的,但我设法将它转换为ant,以便能够使用Liferay Plugin SDK环境。

1

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

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

我希望这会对你有用。