Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions data/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5650,8 +5650,8 @@ If you want to allow all characters, leave the value empty.`
default: '%{user | lower}',
values: setting_types.STRING,
text: `
When this setting is used globally, it changes the username, including
\`%{user}\` variable, for all passdb and userdb lookups.
When this setting is used globally or inside a protocol filter, it changes the
username, including \`%{user}\` variable, for all passdb and userdb lookups.

This setting can also be used in [[link,auth_passwd_file,passdb/userdb
passwd_file { auth_username_format }]] to change the username for the duration
Expand Down Expand Up @@ -10829,13 +10829,25 @@ Username attribute in response.`

oauth2_username_validation_format: {
tags: [ 'oauth2' ],
changed: {
settings_oauth2_username_validation_format_changed: `
The result now goes through the same username translations as the login
username.`
},
values: setting_types.STRING,
default: '%{user}',
seealso: [ 'oauth2_username_attribute' ],
text: `
Normalization for oauth2 provided username, this setting is normally not
needed. You only need this if the username that comes from authentication will
not otherwise match with [[setting,oauth2_username_attribute]] value.`
not otherwise match with [[setting,oauth2_username_attribute]] value.

The result then goes through the same [[setting,auth_username_chars]],
[[setting,auth_username_translation]], [[setting,auth_default_domain]] and
[[setting,auth_username_format]] processing as the login username, before the
two are compared. So these don't need to be repeated here. The same as for the
login username, these settings are used globally or from a protocol filter.
Any passdb-specific values are ignored.`
},

oauth2_active_attribute: {
Expand Down
1 change: 1 addition & 0 deletions data/updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export const updates = {
settings_mailbox_directory_name_legacy_deprecated: '2.4.2',
settings_mailbox_special_use_changed: '2.4.0',
settings_metric_fields_changed: '2.4.0',
settings_oauth2_username_validation_format_changed: '2.4.6',
settings_passdb_default_password_scheme_changed: '2.4.3',
settings_passdb_mechanisms_filter_added: '2.4.0',
settings_passdb_sql_update_query_removed: '2.4.5',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#### OAuth2 Username Translations

With the OAUTHBEARER and XOAUTH2 mechanisms and the oauth2 passdb, the token's
username now goes through the same [[setting,auth_username_chars]],
[[setting,auth_username_translation]], [[setting,auth_default_domain]] and
[[setting,auth_username_format]] processing as the login username, after
[[setting,oauth2_username_validation_format]]. Previously only the login
username was processed, so e.g. with the default
[[setting,auth_username_format]] a token with an upper-case username failed to
log in. A passdb-specific [[setting,auth_username_format]] is not used for the
token's username, only the global or protocol-specific value.

* Token usernames that differ only by these translations (e.g. by case) now
map to the same Dovecot user, the same as with all other login methods.
A format that drops the domain, e.g. `%{user | username}`, also maps
tokens for the same username in different domains to the same user.
* A token username with characters that [[setting,auth_username_chars]]
doesn't allow now fails to log in. Previously only the login username was
checked.
* If [[setting,oauth2_username_validation_format]] repeated these
translations for the token's username, they are now applied twice. This
keeps working only if applying them twice gives the same result (e.g.
lower-casing). Otherwise, e.g. with a format that adds a prefix or a
domain, remove them from [[setting,oauth2_username_validation_format]].
Loading