2009-11-06 41 views
0

我正在爲Websphere Portal 6.1開發獨立的自定義註冊表,自定義登錄portlet和自定義配置文件portlet。一些現有用戶尚未完成其個人資料中的一個或多個必填字段。要求用戶在成功驗證後完成配置文件

這些用戶下次成功登錄時,如何才能讓門戶將它們重定向到之前的自定義配置文件Portlet ,以便他們訪問網站的其餘部分?

+0

不知道,但是這看起來它可能更像是一個Websphere管理問題,而不是一個編程問題。你可以嘗試在ServerFault上發佈這個。 –

+0

謝謝...我會給你一個鏡頭。 – cc1001

回答

2

看起來Websphere Portal 6.1帶有一個通過一系列過濾器發送認證請求的API。我發現了一篇描述開發人員作品API的文章('New security APIs in Websphere Portal')。

特別是,com.ibm.portal.auth.ExplicitLoginFilter接口允許您在身份驗證序列期間插入並在驗證用戶憑據後動態更改系統重定向的位置。這裏是一個存根例如:

public class CustomLoginFilter implements ExplicitLoginFilter { 
    public void login(HttpServletRequest req, HttpServletResponse resp, 
     String userId, char[] password, 
     FilterChainContext portalLoginContext, Subject subject, 
     String realm, ExplicitLoginFilterChain chain) 
     throws LoginException, WSSecurityException, 
     com.ibm.portal.auth.exceptions.LoginException { 

     //Validate the user's credentials. 
     chain.login(req, resp, userId, password, portalLoginContext, subject, realm); 

     //Redirect to profile portlet if required profile fields are incomplete. 
     if(incompleteProfile(userId)) { 
      portalLoginContext.setRedirectURL(getURLForProfilePortlet()); 
     } 
    } 

    //Other methods... 
} 

的ExplicitLoginFilter及其依賴位於以下jar文件,你必須編譯代碼時,添加到您的類路徑:

從您的WebSphere Portal根目錄開始。 ..
/base/wp.auth.base/shared/app/wp.auth.base.jar
/base/wp.base/shared/app/wp.base.jar

+0

僅供參考...代碼示例成功重定向到配置文件頁面,但用戶仍然註銷。正在進行中...... – cc1001

+0

用戶在重定向後仍然註銷,因爲我的方法getURLForProfilePortlet()返回的是以公共門戶網站URI(即/ wps/portal)而不是受保護的URI(即/ wps/myportal )。 – cc1001

相關問題