2011-06-27 42 views
0

我想創建一個帶有Force.com站點頁面的Extranet,並使用允許訪問我的SalesForce.com用戶的身份驗證。Saleforces:使用SalesForce.com用戶身份驗證的Extranet站點

的常見問題表明,它是可能的: http://wiki.developerforce.com/index.php/Sites_FAQ

我試圖與http://wiki.developerforce.com/index.php/Authenticating_Users_on_Force.com_Sites,但只允許用戶登錄並重定向到客戶門戶。

但是,我需要的是在Force.com站點上驗證SalesForce.com用戶。任何想法 ?有沒有辦法做到這一點 ?

回答

0

你引用的wiki頁面(http://wiki.developerforce.com/index.php/Authenticating_Users_on_Force.com_Sites)是去這裏,只是改變了下面的代碼片段的方式:

public class SiteLoginController { 
    public String username {get; set;} 
    public String password {get; set;} 

    public PageReference login() { 
     String startUrl = '/my_site_homepage'; // change the startUrl 
     return Site.login(username, password, startUrl); 
    } 

     public SiteLoginController() {} 

    public static testMethod void testSiteLoginController() { 
     // Instantiate a new controller with all parameters in the page 
     SiteLoginController controller = new SiteLoginController(); 
     controller.username = '[email protected]'; 
     controller.password = '123456'; 

     System.assertEquals(controller.login(),null);       
    }  
} 

正如你可以在PageReference看到login你有startUrl只是更改到登錄後要加載的頁面。