def parse_token(self, token):
try:<EOL><INDENT>data = self.unsign(token)<EOL><DEDENT>except signing.SignatureExpired:<EOL><INDENT>logger.debug("<STR_LIT>", token)<EOL>return<EOL><DEDENT>except signing.BadSignature:<EOL><INDENT>logger.debug("<STR_LIT>", token)<EOL>return<EOL><DEDENT>except Exception:<EOL><INDENT>logger.exception(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>return<EOL><DEDENT>user_pk, data = self.packer.unpack_pk(data)<EOL>user = self.get_user(user_pk)<EOL>if user is None:<EOL><INDENT>logger.debug("<STR_LIT>", token)<EOL>return<EOL><DEDENT>h = crypto.pbkdf2(<EOL>self.get_revocation_key(user),<EOL>self.salt,<EOL>self.iterations,<EOL>digest=self.digest,<EOL>)<EOL>if not crypto.constant_time_compare(data, h):<EOL><INDENT>logger.debug("<STR_LIT>", token)<EOL>return<EOL><DEDENT>logger.debug("<STR_LIT>", user, token)<EOL>return user<EOL>
Obtain a user from a signed token.