2014-02-06 24 views
1

我正在爲Java Apps和Appengine開發Google Apps Marketplace的應用程序。使用Java在Google Apps中獲取當前用戶市場

我需要知道向我的應用發出請求的用戶是否使用Google帳戶登錄。 如果是這種情況,並且用戶已登錄,請使用帶有「服務帳戶」的OAuth2運行應用程序以進行api調用。這發生在我 一種解決方案是使用:

<security-constraint> 
    <web-resource-collection> 
     <web-resource-name>any</web-resource-name> 
     <url-pattern>/*</url-pattern> 
    </web-resource-collection> 
    <auth-constraint> 
     <role-name>*</role-name> 
    </auth-constraint> 
    </security-constraint> 

在「web.xml中」文件。

但是,Google Apps Marketplace經理告訴我,我無法使用此係統。 我也不能使用OAuth2流(Web應用程序的客戶端ID),因爲如果管理員先前已接受此範圍,則用戶不需要接受範圍。

你會使用什麼替代方案? 爲什麼我不能使用「」?

在此先感謝和問候。

+0

爲什麼不使用谷歌用戶Api來檢查是用戶登錄還是不這樣 UserService userService = UserServiceFactory.getUserService(); \t \t com.google.appengine.api.users.User user = \t userService.getCurrentUser(); –

回答