Show More
@@ -270,7 +270,18 b' def login_container_auth(username):' | |||||
270 | return user |
|
270 | return user | |
271 |
|
271 | |||
272 |
|
272 | |||
273 | def get_container_username(environ, config): |
|
273 | def get_container_username(environ, config, clean_username=False): | |
|
274 | """ | |||
|
275 | Get's the container_auth username (or email). It tries to get username | |||
|
276 | from REMOTE_USER if container_auth_enabled is enabled, if that fails | |||
|
277 | it tries to get username from HTTP_X_FORWARDED_USER if proxypass_auth_enabled | |||
|
278 | is enabled. clean_username extracts the username from this data if it's | |||
|
279 | having @ in it. | |||
|
280 | ||||
|
281 | :param environ: | |||
|
282 | :param config: | |||
|
283 | :param clean_username: | |||
|
284 | """ | |||
274 | username = None |
|
285 | username = None | |
275 |
|
286 | |||
276 | if str2bool(config.get('container_auth_enabled', False)): |
|
287 | if str2bool(config.get('container_auth_enabled', False)): | |
@@ -282,7 +293,7 b' def get_container_username(environ, conf' | |||||
282 | username = environ.get('HTTP_X_FORWARDED_USER') |
|
293 | username = environ.get('HTTP_X_FORWARDED_USER') | |
283 | log.debug('extracted HTTP_X_FORWARDED_USER:%s' % (username)) |
|
294 | log.debug('extracted HTTP_X_FORWARDED_USER:%s' % (username)) | |
284 |
|
295 | |||
285 | if username: |
|
296 | if username and clean_username: | |
286 | # Removing realm and domain from username |
|
297 | # Removing realm and domain from username | |
287 | username = username.partition('@')[0] |
|
298 | username = username.partition('@')[0] | |
288 | username = username.rpartition('\\')[2] |
|
299 | username = username.rpartition('\\')[2] |
General Comments 0
You need to be logged in to leave comments.
Login now