-1
我不會來實現認證使用谷歌和Facebook在我的應用程序 類的認證在Java Web應用 沒有任何Java框架用java OAuth將谷歌和Facebook authontication
我嘗試用socialaut 工作,任何一個份額例如其使用Struts和Spring框架,但我不能用我的應用程序框架,以便使在簡單的Tomcat應用程序沒有任何框架
我不會來實現認證使用谷歌和Facebook在我的應用程序 類的認證在Java Web應用 沒有任何Java框架用java OAuth將谷歌和Facebook authontication
我嘗試用socialaut 工作,任何一個份額例如其使用Struts和Spring框架,但我不能用我的應用程序框架,以便使在簡單的Tomcat應用程序沒有任何框架
任何工作,例如在登錄頁面的請求添加以下代碼
SocialAuthConfig config = SocialAuthConfig.getDefault();
config.load(); // load your keys information
SocialAuthManager manager = new SocialAuthManager();
manager.setSocialAuthConfig(config);
String successUrl = "http://localhost:8080/yourapp/status
String url = manager.getAuthenticationUrl("facebook", successUrl);
session.setAttribute("authManager", manager);
重定向YOUT頁面網址進行驗證
添加此代碼上/狀態URL
SocialAuthManager manager = (SocialAuthManager)session.getAttribute("authManager");
AuthProvider provider = manager.connect(paramsMap);
// get profile
Profile p = provider.getUserProfile();
// you can obtain profile information
System.out.println(p.getFirstName());
// OR also obtain list of contacts
List<Contact> contactsList = provider.getContactList();
[你嘗試過什麼?](http://mattgemmell.com/2008/12/08/你試過什麼/) –
我試着用socialaut它使用struts和spring框架,但是我沒有在我的應用程序中使用這個框架,所以給出了任何在沒有任何框架的簡單tomcat應用程序中工作的例子 – jayesh