Show More
@@ -307,11 +307,8 b' class Session(Configurable):' | |||
|
307 | 307 | |
|
308 | 308 | key = CBytes(b'', config=True, |
|
309 | 309 | help="""execution key, for extra authentication.""") |
|
310 |
def _key_changed(self |
|
|
311 |
|
|
|
312 | self.auth = hmac.HMAC(new, digestmod=self.digest_mod) | |
|
313 | else: | |
|
314 | self.auth = None | |
|
310 | def _key_changed(self): | |
|
311 | self._new_auth() | |
|
315 | 312 | |
|
316 | 313 | signature_scheme = Unicode('hmac-sha256', config=True, |
|
317 | 314 | help="""The digest scheme used to construct the message signatures. |
@@ -324,6 +321,7 b' class Session(Configurable):' | |||
|
324 | 321 | self.digest_mod = getattr(hashlib, hash_name) |
|
325 | 322 | except AttributeError: |
|
326 | 323 | raise TraitError("hashlib has no such attribute: %s" % hash_name) |
|
324 | self._new_auth() | |
|
327 | 325 | |
|
328 | 326 | digest_mod = Any() |
|
329 | 327 | def _digest_mod_default(self): |
@@ -331,6 +329,12 b' class Session(Configurable):' | |||
|
331 | 329 | |
|
332 | 330 | auth = Instance(hmac.HMAC) |
|
333 | 331 | |
|
332 | def _new_auth(self): | |
|
333 | if self.key: | |
|
334 | self.auth = hmac.HMAC(self.key, digestmod=self.digest_mod) | |
|
335 | else: | |
|
336 | self.auth = None | |
|
337 | ||
|
334 | 338 | digest_history = Set() |
|
335 | 339 | digest_history_size = Integer(2**16, config=True, |
|
336 | 340 | help="""The maximum number of digests to remember. |
General Comments 0
You need to be logged in to leave comments.
Login now