• bartfab@chromium.org's avatar
    Switch GAIA e-mail address retrieval from /GetUserInfo to /ListAccounts · 2f18ff3d
    bartfab@chromium.org authored
    Previously, the Chrome OS SAML login flow was passing the LSID obtained
    via /ServiceLogin to /GetUserInfo in order to retrieve the authenticated
    user's e-mail address. It turns out that this is wrong because
    /ServiceLogin yields a browser LSID and /GetUserInfo expects a
    programmatic LSID. In many cases, the two LSID flavors are identical and
    the existing code worked. But under some conditions, the browser LSID
    could be different, causing /GetUserInfo to fail.
    
    This CL switches to /ListAccounts instead, which handles browser LSIDs.
    An additional advantage of /ListAccounts is that it will read the LSID
    from cookies, removing the need to extract the LSID from the cookie jar
    explicitly.
    
    I could have further simplified the code by doing an XHR to /ListAccounts
    from the JS code of the auth extension, avoiding the JS -> C++ -> JS round
    trip. However, this would have been a CORS request, requiring the GAIA
    URL to be hard-coded in the auth extension's manifest. The implementation
    in this CL, which makes the /ListAccounts call from C++, is more flexible
    as it preserves the ability to change the GAIA URL via a command-line
    flag.
    
    BUG=332132
    TEST=Updated browser test and manual
    
    Review URL: https://codereview.chromium.org/134483008
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245585 0039d316-1c4b-4281-b951-d872f2087c98
    2f18ff3d
fake_gaia.cc 18.7 KB