[ 
https://issues.apache.org/jira/browse/GERONIMO-6780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard Zowalla closed GERONIMO-6780.
-------------------------------------
    Resolution: Fixed

Fixed on main in commit dd94de3, shipping in Mail_2.1_1.1.1.

XOAUTH2 support itself had been added since this issue was filed, but it was 
only reachable through mail.<protocol>.sasl.enable together with 
mail.<protocol>.sasl.mechanisms, so an application coming from the reference 
implementation still had to be reconfigured before it could authenticate. The 
keys it uses are now accepted:

  mail.<protocol>.auth.mechanisms=XOAUTH2
  mail.<protocol>.auth.xoauth2.disable=false

Pass the access token where the password would go, e.g. store.connect(host, 
user, accessToken).

auth.mechanisms is honoured as an alias of sasl.mechanisms and restricts which 
mechanisms are considered; the SASL-specific key still wins where both are set. 
XOAUTH2 needs no SASL API of its own, so it is now selected outside the 
sasl.enable branch. It is only ever chosen when the application asked for it 
and the server advertises it, since the mechanism needs an access token rather 
than a password.

SMTP, POP3 and NNTP already reached AuthenticatorFactory unconditionally; IMAP 
gated XOAUTH2 behind sasl.enable and now attempts it after the SASL block, 
before the PLAIN and LOGIN fallbacks. The existing sasl.enable configuration 
keeps working unchanged.

One limitation worth stating: auth.mechanisms restricts but does not reorder. 
Apart from XOAUTH2 being tried first when asked for, the remaining mechanisms 
are still selected strongest first (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN). Full 
ordering support would be a separate change.

Documented in the README. Covered by new tests in AuthenticationTest for both 
keys. Jakarta Mail 2.1 TCK: 321/321.

Thanks Cesar for the original patch and for raising this.

> Oauth2 support for geronimo Java Mail Provider
> ----------------------------------------------
>
>                 Key: GERONIMO-6780
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-6780
>             Project: Geronimo
>          Issue Type: New Feature
>      Security Level: public(Regular issues) 
>          Components: mail
>            Reporter: Cesar Hernandez
>            Priority: Major
>
> Support for OAuth2 authentication was added since JavaMail 1.5.2.  [1]
> Geronimo mail latest release [2] doesn't have this authentication mechanism.
>  
> [1]
> https://eclipse-ee4j.github.io/mail/OAuth2 
>  
> [2]
> https://github.com/apache/geronimo-javamail/tags



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to