jakartaee / jakartaee/mail-api

Customizable SPN Service Class for GSSAPI Authentication

Open
#740 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
285
Forks
109
Avg merge
15h 19m
Merged PRs (30d)
1

Description

The JavaMail specifications do not explicitly define how the SPN service classes should be constructed when using GSSAPI authentication. This omission has led to hardcoded service classes, such as `smtp/host@realm`, across implementations, limiting compatibility with various Kerberos environments.

I propose updating the JavaMail specs to:

* Introduce a property, `mail.smtp.sasl.gssapi.spnserviceclass`, to allow customization of the service class.
* Specify that the default can remain `smtp` (or whatever the implementer was using) if no customization is provided.

### References:
* [Name Formats for Unique SPNs](https://learn.microsoft.com/en-us/windows/win32/ad/name-formats-for-unique-spns)

### Eclipse Angus's Implementation:
```java
// https://github.com/eclipse-ee4j/angus-mail/blob/master/providers/smtp/src/main/java/org/eclipse/angus/mail/smtp/SMTPTransport.java

public class SMTPTransport extends Transport {
private String name = "smtp"; // Name of this protocol
...
saslAuthenticator = (SaslAuthenticator) c.newInstance(
new Object[]{
this,
name, // <-- hardcoded service name
session.getProperties(),
logger,
serviceHost
});
...
}

// https://github.com/eclipse-ee4j/angus-mail/blob/master/providers/smtp/src/main/java/org/eclipse/angus/mail/smtp/SMTPSaslAuthenticator.java

public SMTPSaslAuthenticator(SMTPTransport pr, String name,
Properties props, MailLogger logger, String host) {
...
this.name = name;
...
}
...
Map propsMap = (Map) props;
sc = Sasl.createSaslClient(mechs, authzid, name, host, // <-- hardcoded service name
propsMap, cbh);
...

Contributor guide

Open the contributing guide

Research direction

Review the Jakarta Mail specification sections covering SMTP GSSAPI authentication and compare them with the cited Angus files, providers/smtp/src/main/java/org/eclipse/angus/mail/smtp/SMTPTransport.java and SMTPSaslAuthenticator.java. Define the property and its default behavior precisely, then confirm that the specification clearly describes customizable SPN service classes. No test file is mentioned in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authentication
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.