##// END OF EJS Templates
authn: don't use formatted_json to log statements. It totally screws up...
marcink -
r12:2adf7c1f default
parent child Browse files
Show More
@@ -36,7 +36,6 b' from sqlalchemy.ext.hybrid import hybrid'
36 from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin
36 from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin
37 from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase
37 from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase
38 from rhodecode.authentication.routes import AuthnPluginResourceBase
38 from rhodecode.authentication.routes import AuthnPluginResourceBase
39 from rhodecode.lib.ext_json import formatted_json
40 from rhodecode.lib.utils2 import safe_unicode
39 from rhodecode.lib.utils2 import safe_unicode
41 from rhodecode.model.db import User
40 from rhodecode.model.db import User
42
41
@@ -119,17 +118,15 b' class RhodeCodeAuthPlugin(RhodeCodeExter'
119 log.debug('Empty username or password skipping...')
118 log.debug('Empty username or password skipping...')
120 return None
119 return None
121
120
122 log.debug("Jasig CAS settings: \n%s" % (formatted_json(settings)))
121 log.debug("Jasig CAS settings: %s", settings)
123 params = urllib.urlencode({'username': username, 'password': password})
122 params = urllib.urlencode({'username': username, 'password': password})
124 headers = {"Content-type": "application/x-www-form-urlencoded",
123 headers = {"Content-type": "application/x-www-form-urlencoded",
125 "Accept": "text/plain",
124 "Accept": "text/plain",
126 "User-Agent": "RhodeCode-auth-%s" % rhodecode.__version__}
125 "User-Agent": "RhodeCode-auth-%s" % rhodecode.__version__}
127 url = settings["service_url"]
126 url = settings["service_url"]
128
127
129 log.debug("Sent Jasig CAS: \n%s"
128 log.debug("Sent Jasig CAS: \n%s",
130 % (formatted_json({"url": url,
129 {"url": url, "body": params, "headers": headers})
131 "body": params,
132 "headers": headers})))
133 request = urllib2.Request(url, params, headers)
130 request = urllib2.Request(url, params, headers)
134 try:
131 try:
135 response = urllib2.urlopen(request)
132 response = urllib2.urlopen(request)
@@ -36,7 +36,6 b' from rhodecode.authentication.routes imp'
36 from rhodecode.lib.exceptions import (
36 from rhodecode.lib.exceptions import (
37 LdapConnectionError, LdapUsernameError, LdapPasswordError, LdapImportError
37 LdapConnectionError, LdapUsernameError, LdapPasswordError, LdapImportError
38 )
38 )
39 from rhodecode.lib.ext_json import formatted_json
40 from rhodecode.lib.utils2 import safe_unicode, safe_str
39 from rhodecode.lib.utils2 import safe_unicode, safe_str
41 from rhodecode.model.db import User
40 from rhodecode.model.db import User
42 from rhodecode.model.validators import Missing
41 from rhodecode.model.validators import Missing
@@ -435,7 +434,7 b' class RhodeCodeAuthPlugin(RhodeCodeExter'
435 'extern_name': user_dn,
434 'extern_name': user_dn,
436 'extern_type': extern_type,
435 'extern_type': extern_type,
437 }
436 }
438 log.debug('ldap user: \n%s', formatted_json(user_attrs))
437 log.debug('ldap user: %s', user_attrs)
439 log.info('user %s authenticated correctly', user_attrs['username'])
438 log.info('user %s authenticated correctly', user_attrs['username'])
440
439
441 return user_attrs
440 return user_attrs
@@ -35,7 +35,6 b' from sqlalchemy.ext.hybrid import hybrid'
35 from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin
35 from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin
36 from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase
36 from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase
37 from rhodecode.authentication.routes import AuthnPluginResourceBase
37 from rhodecode.authentication.routes import AuthnPluginResourceBase
38 from rhodecode.lib.ext_json import formatted_json
39
38
40 log = logging.getLogger(__name__)
39 log = logging.getLogger(__name__)
41
40
@@ -151,6 +150,6 b' class RhodeCodeAuthPlugin(RhodeCodeExter'
151 log.warning("Cannot extract additional info for PAM user")
150 log.warning("Cannot extract additional info for PAM user")
152 pass
151 pass
153
152
154 log.debug("pamuser: \n%s" % formatted_json(user_attrs))
153 log.debug("pamuser: %s", user_attrs)
155 log.info('user %s authenticated correctly' % user_attrs['username'])
154 log.info('user %s authenticated correctly' % user_attrs['username'])
156 return user_attrs
155 return user_attrs
General Comments 0
You need to be logged in to leave comments. Login now