MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / ManagedSession

Class ManagedSession

web/pgadmin/utils/session.py:139–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137
138
139class ManagedSession(CallbackDict, SessionMixin):
140 def __init__(self, initial=None, sid=None, new=False, randval=None,
141 hmac_digest=None):
142 def on_update(self):
143 self.modified = True
144
145 CallbackDict.__init__(self, initial, on_update)
146 self.sid = sid
147 self.new = new
148 self.modified = False
149 self.randval = randval
150 self.last_write = None
151 self.force_write = False
152 self.hmac_digest = hmac_digest
153 self.permanent = True
154
155 def sign(self, secret):
156 if not self.hmac_digest:
157 population = string.ascii_lowercase + string.digits
158
159 self.randval = ''.join(
160 secrets.choice(population) for i in range(20))
161 self.hmac_digest = _calc_hmac(
162 '%s:%s' % (self.sid, self.randval), secret)
163
164
165class SessionManager():

Callers 2

new_sessionMethod · 0.85
getMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected