don't create ssl/auth keys if disabled

fixes https://github.com/lbryio/lbry/issues/1624
This commit is contained in:
Jack Robison 2018-11-16 10:55:53 -05:00
parent 3a27a4509a
commit 1b74594f5b
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 5 additions and 3 deletions

View file

@ -42,7 +42,7 @@ class AuthJSONRPCResource(resource.Resource):
realm = HttpPasswordRealm(self) realm = HttpPasswordRealm(self)
portal_to_realm = portal.Portal(realm, [checker, ]) portal_to_realm = portal.Portal(realm, [checker, ])
root = guard.HTTPAuthSessionWrapper( root = guard.HTTPAuthSessionWrapper(
portal_to_realm, [guard.BasicCredentialFactory('Login to lbrynet api'), ] portal_to_realm, [guard.BasicCredentialFactory(b'Login to lbrynet api'), ]
) )
else: else:
log.info("Using non-authenticated API") log.info("Using non-authenticated API")

View file

@ -206,7 +206,6 @@ class AuthJSONRPCServer(AuthorizedBase):
self.announced_startup = False self.announced_startup = False
self.sessions = {} self.sessions = {}
self.server = None self.server = None
self.keyring = Keyring.generate_and_save()
@defer.inlineCallbacks @defer.inlineCallbacks
def start_listening(self): def start_listening(self):
@ -284,7 +283,10 @@ class AuthJSONRPCServer(AuthorizedBase):
return d return d
def get_server_factory(self): def get_server_factory(self):
return AuthJSONRPCResource(self).getServerFactory(self.keyring, self._use_authentication, self._use_https) keyring = None
if self._use_authentication or self._use_https:
keyring = Keyring.generate_and_save()
return AuthJSONRPCResource(self).getServerFactory(keyring, self._use_authentication, self._use_https)
def _set_headers(self, request, data, update_secret=False): def _set_headers(self, request, data, update_secret=False):
if conf.settings['allowed_origin']: if conf.settings['allowed_origin']: