Skip to content

Commit a63c1a4

Browse files
committed
Add config option 'http_auth_convert_realm_to_lowercase'
1 parent c6180bf commit a63c1a4

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

CHANGES.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ Features:
4040
(current 4.4.1). The pull request has been around for a
4141
while. (Patch: Paul Spooren; templates merged by Christof Meerwald;
4242
other merged by John Rouillard)
43+
- Add config option 'http_auth_convert_realm_to_lowercase'
44+
If usernames consist of a name and a domain/realm part of the form
45+
user@realm and we're using REMOTE_USER for authentication (e.g. via
46+
Kerberos), convert the realm part of the incoming REMOTE_USER to
47+
lowercase before matching against the roundup username. This allows
48+
roundup usernames to be lowercase (including the realm) and still
49+
follow the Kerberos convention of using an uppercase realm. In
50+
addition this is compatible with Active Directory which stores the
51+
username with realm as UserPrincipalName in lowercase.
52+
4353

4454
Fixed:
4555

roundup/cgi/client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,10 +1001,14 @@ def determine_user(self):
10011001

10021002
user = None
10031003
# first up, try http authorization if enabled
1004-
if self.instance.config['WEB_HTTP_AUTH']:
1004+
cfg = self.instance.config
1005+
if cfg.WEB_HTTP_AUTH:
10051006
if 'REMOTE_USER' in self.env:
10061007
# we have external auth (e.g. by Apache)
10071008
user = self.env['REMOTE_USER']
1009+
if cfg.WEB_HTTP_AUTH_CONVERT_REALM_TO_LOWERCASE and '@' in user:
1010+
u, d = user.split ('@', 1)
1011+
user = '@'.join ((u, d.lower()))
10081012
elif self.env.get('HTTP_AUTHORIZATION', ''):
10091013
# try handling Basic Auth ourselves
10101014
auth = self.env['HTTP_AUTHORIZATION']

roundup/configuration.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,17 @@ def str2value(self, value):
828828
"variables supplied by your web server (in that order).\n"
829829
"Set this option to 'no' if you do not wish to use HTTP Basic\n"
830830
"Authentication in your web interface."),
831+
(BooleanOption, 'http_auth_convert_realm_to_lowercase', "no",
832+
"If usernames consist of a name and a domain/realm part of\n"
833+
"the form user@realm and we're using REMOTE_USER for\n"
834+
"authentication (e.g. via Kerberos), convert the realm part\n"
835+
"of the incoming REMOTE_USER to lowercase before matching\n"
836+
"against the roundup username. This allows roundup usernames\n"
837+
"to be lowercase (including the realm) and still follow the\n"
838+
"Kerberos convention of using an uppercase realm. In\n"
839+
"addition this is compatible with Active Directory which\n"
840+
"stores the username with realm as UserPrincipalName in\n"
841+
"lowercase."),
831842
(IntegerNumberGeqZeroOption, 'login_attempts_min', "3",
832843
"Limit login attempts per user per minute to this number.\n"
833844
"By default the 4th login attempt in a minute will notify\n"

0 commit comments

Comments
 (0)