Commit c4e1672b authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

don't break startup because of missing configuration. This may be desired for...

don't break startup because of missing configuration. This may be desired for non-web instance, in which case we simply want trustedauth to be deactivated
parent 64a08286455a
......@@ -26,14 +26,16 @@ CONFENTRY = 'trustedauth-secret-key-file'
def registration_callback(vreg):
secretfile = vreg.config.get(CONFENTRY, "").strip()
if not secretfile:
raise ConfigurationError("Configuration '%s' is missing or empty. "
"Please check tour configuration file!" % CONFENTRY)
vreg.config.error("Configuration '%s' is missing or empty. "
"Please check tour configuration file!" % CONFENTRY)
return
try:
secret = open(secretfile).read().strip()
except IOError:
raise ConfigurationError("Cannot open secret key file. Check your configuration file!")
vreg.config.error("Cannot open secret key file. Check your configuration file!")
return
if not secret or len(secret) > 32:
raise ConfigurationError('secret key must me a string 0 < len(key) <= 32')
vreg.config.error('secret key must me a string 0 < len(key) <= 32')
return
vreg.config._secret = secret.ljust(32, '#')
vreg.debug('loaded secret key')
......@@ -21,6 +21,7 @@ options = (
{'type': 'string',
'help': _('Qualified file path to the shared secret key between'
'the web part and the data repository'),
'default': '',
'group': 'trustedauth',
}),
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment