Closed Bug 1927998 Opened 3 months ago Closed 24 days ago

Better, unified OAuth handling

Categories

(Thunderbird :: General, enhancement)

enhancement

Tracking

(relnote-thunderbird 135+, thunderbird_esr128 wontfix)

RESOLVED FIXED
135 Branch
Tracking Status
relnote-thunderbird --- 135+
thunderbird_esr128 --- wontfix

People

(Reporter: darktrojan, Assigned: darktrojan)

References

Details

Attachments

(7 files)

We have multiple consumers of OAuth2 and they all do things in different ways. I'm not really happy with any of them and I'm especially not happy that there's not one unified piece of code that handles it all. This is a medium-term project to fix that.

  • Mail protocols use the OAuth2Module which handles token saving/retrieval and interaction with the async authentication system.
  • CardDAV generally does the same thing, but not initial discovery and set-up of address books. That handles saving tokens itself.
  • CalDAV does it very differently, there is a subclass of OAuth2 for each supported provider and they handle token saving/retrieval through the calendar's system for that. There's also multiple historic formats for storing CalDAV OAuth tokens.

The first steps here will be to reform OAuth2Module and OAuth2Providers so that they handle multiple scopes better. The code was originally intended for only a single scope but we hacked multiple scopes into it and it doesn't work very well.

Then we'll change CardDAV and CalDAV to use the same code so that any further changes only need to be made once. I've filed bug 1927971 to find out more about CalDAV's tokens in the wild, so we'll need to wait until we have some useful information from that.

Finally I think we can overhaul the whole system and create a better interface for getting what we need. But that's a fair way off yet.

Keywords: meta
Keywords: meta
Summary: [meta] Better, unified OAuth handling → Better, unified OAuth handling

I've changed getHostnameDetails to take an optional second argument, and return a list of
required scopes (based on the new argument) as well as a list of all scopes. This way we can
better determine if we have all of the scopes we need to complete the current action.

… and only update it when it actually changed.

This removes the last traces of the Lightning oAuth client for Google calendars. Some users will
have to reauthenticate but it's a very small fraction of users.

Attachment #9438442 - Attachment description: Bug 1927998 - Stop storing oAuth2 details in preferences. r=leftmostcat,mkmelin → Bug 1927998 - Stop storing OAuth2 details in preferences. r=leftmostcat,mkmelin
Attachment #9438443 - Attachment description: Bug 1927998 - Store oAuth2 scopes separately. r=leftmostcat,mkmelin → Bug 1927998 - Store OAuth2 scopes separately. r=leftmostcat,mkmelin
Attachment #9438444 - Attachment description: Bug 1927998 - Update the last-updated time of oAuth tokens. r=leftmostcat,mkmelin → Bug 1927998 - Update the last-updated time of OAuth tokens. r=leftmostcat,mkmelin
Attachment #9438442 - Attachment description: Bug 1927998 - Stop storing OAuth2 details in preferences. r=leftmostcat,mkmelin → Bug 1927998 - Stop storing OAuth2 details in preferences. r=leftmostcat,mkmelin,babolivier
Attachment #9438443 - Attachment description: Bug 1927998 - Store OAuth2 scopes separately. r=leftmostcat,mkmelin → Bug 1927998 - Store OAuth2 scopes separately. r=leftmostcat,mkmelin,babolivier

Will this allow us to delete tokens when we no longer need them? It would be great if we could update our privacy policy to include more reassuring wording on that matter...

Flags: needinfo?(geoff)
Flags: needinfo?(geoff)
Keywords: leave-open
Target Milestone: --- → 135 Branch
Pushed by geoff@darktrojan.net: https://hg.mozilla.org/comm-central/rev/9d6b0dd35077 Stop storing OAuth2 details in preferences. r=leftmostcat,mkmelin,babolivier https://hg.mozilla.org/comm-central/rev/8c594cb3017a Store OAuth2 scopes separately. r=leftmostcat,mkmelin,babolivier https://hg.mozilla.org/comm-central/rev/425daaa18ed2 Update the last-updated time of OAuth tokens. r=leftmostcat,mkmelin https://hg.mozilla.org/comm-central/rev/a45216aaccc7 Change CardDAV to use OAuth2Module. r=leftmostcat,mkmelin https://hg.mozilla.org/comm-central/rev/3efacfab89ff Move CalDAV to OAuth2Module. r=leftmostcat,mkmelin
Pushed by geoff@darktrojan.net: https://hg.mozilla.org/comm-central/rev/1e668ff6b0f3 Make type argument of getHostnameDetails non-optional. r=leftmostcat,mkmelin https://hg.mozilla.org/comm-central/rev/183005fe50a9 Make getHostnameDetails return an object instead of an array. r=leftmostcat
See Also: → 1935921
Regressions: 1935947

Closing this. There are still things I want to do but I'll open a new bug for them.

Release Note Request (optional, but appreciated)
[Why is this notable]: This has potential to break things for users.
[Suggested wording]: OAuth2 authentication overhauled. CardDAV address books and CalDAV calendars now use the same OAuth2 code as mail. Provider information is no longer stored in preferences.
[Links (documentation, blog post, etc)]:

Status: ASSIGNED → RESOLVED
Closed: 24 days ago
Keywords: leave-open
Resolution: --- → FIXED

Release note added to 135.0b1. Thanks! I did drop the first sentence to shorten it up to fit on one line.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: