authn: don't use formatted_json to log statements. It totally screws up
logging formatting, and makes big entries in logs with newlines.
This commit is contained in:
parent
825f205dfb
commit
19ef5c2721
3 changed files with 5 additions and 10 deletions
|
|
@ -36,7 +36,6 @@ from sqlalchemy.ext.hybrid import hybrid_property
|
|||
from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin
|
||||
from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase
|
||||
from rhodecode.authentication.routes import AuthnPluginResourceBase
|
||||
from rhodecode.lib.ext_json import formatted_json
|
||||
from rhodecode.lib.utils2 import safe_unicode
|
||||
from rhodecode.model.db import User
|
||||
|
||||
|
|
@ -119,17 +118,15 @@ class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
|||
log.debug('Empty username or password skipping...')
|
||||
return None
|
||||
|
||||
log.debug("Jasig CAS settings: \n%s" % (formatted_json(settings)))
|
||||
log.debug("Jasig CAS settings: %s", settings)
|
||||
params = urllib.urlencode({'username': username, 'password': password})
|
||||
headers = {"Content-type": "application/x-www-form-urlencoded",
|
||||
"Accept": "text/plain",
|
||||
"User-Agent": "RhodeCode-auth-%s" % rhodecode.__version__}
|
||||
url = settings["service_url"]
|
||||
|
||||
log.debug("Sent Jasig CAS: \n%s"
|
||||
% (formatted_json({"url": url,
|
||||
"body": params,
|
||||
"headers": headers})))
|
||||
log.debug("Sent Jasig CAS: \n%s",
|
||||
{"url": url, "body": params, "headers": headers})
|
||||
request = urllib2.Request(url, params, headers)
|
||||
try:
|
||||
response = urllib2.urlopen(request)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ from rhodecode.authentication.routes import AuthnPluginResourceBase
|
|||
from rhodecode.lib.exceptions import (
|
||||
LdapConnectionError, LdapUsernameError, LdapPasswordError, LdapImportError
|
||||
)
|
||||
from rhodecode.lib.ext_json import formatted_json
|
||||
from rhodecode.lib.utils2 import safe_unicode, safe_str
|
||||
from rhodecode.model.db import User
|
||||
from rhodecode.model.validators import Missing
|
||||
|
|
@ -435,7 +434,7 @@ class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
|||
'extern_name': user_dn,
|
||||
'extern_type': extern_type,
|
||||
}
|
||||
log.debug('ldap user: \n%s', formatted_json(user_attrs))
|
||||
log.debug('ldap user: %s', user_attrs)
|
||||
log.info('user %s authenticated correctly', user_attrs['username'])
|
||||
|
||||
return user_attrs
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ from sqlalchemy.ext.hybrid import hybrid_property
|
|||
from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin
|
||||
from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase
|
||||
from rhodecode.authentication.routes import AuthnPluginResourceBase
|
||||
from rhodecode.lib.ext_json import formatted_json
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -151,6 +150,6 @@ class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
|||
log.warning("Cannot extract additional info for PAM user")
|
||||
pass
|
||||
|
||||
log.debug("pamuser: \n%s" % formatted_json(user_attrs))
|
||||
log.debug("pamuser: %s", user_attrs)
|
||||
log.info('user %s authenticated correctly' % user_attrs['username'])
|
||||
return user_attrs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue