2016-10-03 55 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來攔截請求標頭,並更改門戶用於登錄的方法。

我希望這會對你有用。