Skip to content

Commit 2c87120

Browse files
committed
New config-option 'cookie_takes_precedence'
.. in the [web] section. This allows sub-logins (e.g. without a password given a specific role) even when a non-cookie login mechanism (like Kerberos) is in use. With that mechanism e.g., a Kerberos ticket will not take precedence over an existing cookie. This might become the default in the future and the new option might go away.
1 parent cc7f271 commit 2c87120

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

CHANGES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ Features:
5757
variable. (John Rouillard)
5858
- New roundup-admin command importtables allows importing just the
5959
database dump created by exporttables. (John Rouillard)
60+
- New config-option 'cookie_takes_precedence' in the [web] section. This
61+
allows sub-logins (e.g. without a password given a specific role) even
62+
when a non-cookie login mechanism (like Kerberos) is in use. With that
63+
mechanism e.g., a Kerberos ticket will not take precedence over an
64+
existing cookie. This might become the default in the future and the
65+
new option might go away.
6066

6167
2020-04-05 2.0.0 beta 0
6268

roundup/cgi/client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,14 @@ def determine_user(self):
997997
user = None
998998
# first up, try http authorization if enabled
999999
cfg = self.instance.config
1000-
if cfg.WEB_HTTP_AUTH:
1000+
if cfg.WEB_COOKIE_TAKES_PRECEDENCE:
1001+
user = self.session_api.get('user')
1002+
if user:
1003+
# update session lifetime datestamp
1004+
self.session_api.update()
1005+
if 'REMOTE_USER' in self.env:
1006+
del self.env['REMOTE_USER']
1007+
if not user and cfg.WEB_HTTP_AUTH:
10011008
if 'REMOTE_USER' in self.env:
10021009
# we have external auth (e.g. by Apache)
10031010
user = self.env['REMOTE_USER']

roundup/configuration.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -731,11 +731,10 @@ def str2value(self, value):
731731
"admin role may see these history entries, you can make them\n"
732732
"visible to all users by adding, e.g., the 'User' role here."),
733733
(Option, "error_messages_to", "user",
734-
# XXX This description needs better wording,
735-
# with explicit allowed values list.
736-
"Send error message emails to the dispatcher, user, or both?\n"
737-
"The dispatcher is configured using the DISPATCHER_EMAIL"
738-
" setting."),
734+
'Send error message emails to the "dispatcher", "user", '
735+
'or "both" (these are the allowed values)?\n'
736+
'The dispatcher is configured using the DISPATCHER_EMAIL'
737+
' setting.'),
739738
(Option, "html_version", "html4",
740739
"HTML version to generate. The templates are html4 by default.\n"
741740
"If you wish to make them xhtml, then you'll need to change this\n"
@@ -841,6 +840,16 @@ def str2value(self, value):
841840
"addition this is compatible with Active Directory which\n"
842841
"stores the username with realm as UserPrincipalName in\n"
843842
"lowercase."),
843+
(BooleanOption, 'cookie_takes_precedence', "no",
844+
"If the http_auth option is in effect (see above)\n"
845+
"we're accepting a REMOTE_USER variable resulting from\n"
846+
"an authentication mechanism implemented in the web-server,\n"
847+
"e.g., Kerberos login or similar. To override the mechanism\n"
848+
"provided by the web-server (e.g. for enabling sub-login as\n"
849+
"another user) we tell roundup that the cookie takes\n"
850+
"precedence over a REMOTE_USER or HTTP_AUTHORIZATION\n"
851+
"variable. So if both, a cookie and a REMOTE_USER is\n"
852+
"present, the cookie wins.\n"),
844853
(IntegerNumberGeqZeroOption, 'login_attempts_min', "3",
845854
"Limit login attempts per user per minute to this number.\n"
846855
"By default the 4th login attempt in a minute will notify\n"

0 commit comments

Comments
 (0)