Restrict Google account logins to a specified Apps domain

风流意气都作罢 提交于 2019-12-04 15:36:02

Have a look at the OpenID docs others suggested. In brief, you need to redirect the user to a custom login URL based on their domain name - i.e. you need to find out their domain name before you redirect i.e. your hd parameter, which indeed forces login to the specified domain

This is also needed to support SSO for Google Apps domains, where the authentication for the user isn't handled by Google but by a third party service.

Make sure you check the openID provider, not just the email address domain name, once you do get the auth info.

You can use the OpenID endpoints for Google Apps domains as described here: http://groups.google.com/group/google-federated-login-api/web/openid-discovery-for-hosted-domains

Depending on your OpenID library, you may/may not be able to use it though. Eg openid4java doesn't support it yet

Christian Davén

It seems I can use the OpenID+OAuth Hybrid protocol to both identify the user and get an access token to the data APIs, as described in this blog post.

Edit: updated dead link to live blog post.

See this question for info about how to get the user's email using OpenID. I guess I can then verify that it ends with the correct domain name.

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