Authorization/Authentication with Google account in GWT

空扰寡人 提交于 2019-12-07 21:32:37

问题


I'm trying to enable my GWT application authenticate users with their Google accounts. What I basically need is just to have an unique value for every user and be sure that these values will always describe correct users. The main requirement is, the number of lines of code I have to write is as small as possible :-)

I'm trying to use gwt-oauth2 library, but it looks like the whole idea of OAuth is to provide a token that allows access to different private resources like mail, contacts, etc., but it doesn't define the user itself.

Question #1 - is that right that token Google gives me only defines "session with rights to access user's private data" and it doesn't define "the unique user"?

Question #2 - should I use OpenID instead, since I'm 100% sure I'll never need to access any private data and the only thing I need is to have user's unique descriptor?

For those who consider it a duplicate of Easiest way to enable Google authentication for GWT application? (non-GAE-hosted). This question is not about libraries to use to solve the problem ASAP, this question is about understanding of "whether authentication is a subset of authorization". The question is OAuth vs. OpenID for my case.


回答1:


1) The point of OAuth is to allow a site owner to access certain info the user allows. You don't get a "unique user", however you could request their e-mail address and/or name and store that, then retrieve it when they log back in via OAuth.

2) Yeah, OpenID probably a better option for your use case. If you're not saving the user's info, don't bother asking them to give you access to it. OpenID does offer unique IDs for users.




回答2:


If you're searchig to go further by controlling what is visible/enabled to the user (authorizations), and how it is displayed. I just created a solution for that. I hope you'll enjoy:

Use the project UiBinderAutho to catch widget creation and adapt them to your needs (connected profile ui, rights, widget handlers). Some explanations here http://ziedhamdi.github.io/UiBinderAutho/

here are the github projects https://github.com/ziedHamdi



来源:https://stackoverflow.com/questions/7534374/authorization-authentication-with-google-account-in-gwt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!