move auth_state encryption outside the ORM

privy is used for encryption

- db only has blob column, no knowledge of encryption
- add CryptKeeper for handling encryption
- use privy for encryption, so we have fewer choices to make
- storing/loading encrypted auth_state runs in a ThreadPool
This commit is contained in:
Min RK
2017-07-28 13:44:37 +02:00
parent 32a9b38d26
commit 90e8e1a8aa
8 changed files with 256 additions and 176 deletions

View File

@@ -334,7 +334,7 @@ class BaseHandler(RequestHandler):
# always set auth_state and commit,
# because there could be key-rotation or clearing of previous values
# going on.
user.auth_state = auth_state
yield user.save_auth_state(auth_state)
self.db.commit()
self.set_login_cookie(user)
self.statsd.incr('login.success')