Using OpenID for authentication. How do I get the name of the openid provider once the user is logged in?
The aim would be to pop up a relevant message with the name of the openid provider when the开发者_开发问答 user clicks logout. e.g, "Please logout of your google account" if the user is logged in using google as the openid provider.I was planning to use request.getHeader("Referer");every time a page is loaded and if it contains claimid = google.com then I would set a cookie with the value googleauth. Is that the right way to go. Any other way I could get the auth provider from userservice?
google.appengine.api.users.User
object has federated_provider
method that returns the URL of OpenID provider which was used to authenticate the user. You could use a mapping of this URLs (e.g. using this table) to user-friendly names such as "Google Accounts".
精彩评论