mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Remove padding space around caveat operators
This commit is contained in:
parent
42e858daeb
commit
ce832c38d4
@ -278,12 +278,12 @@ class RegistrationHandler(BaseHandler):
|
||||
location = self.hs.config.server_name,
|
||||
identifier = "key",
|
||||
key = self.hs.config.macaroon_secret_key)
|
||||
macaroon.add_first_party_caveat("gen = 1")
|
||||
macaroon.add_first_party_caveat("user_id = %s" % (user_id,))
|
||||
macaroon.add_first_party_caveat("type = access")
|
||||
macaroon.add_first_party_caveat("gen=1")
|
||||
macaroon.add_first_party_caveat("user_id=%s" % (user_id,))
|
||||
macaroon.add_first_party_caveat("type=access")
|
||||
now = self.hs.get_clock().time_msec()
|
||||
expiry = now + (60 * 60 * 1000)
|
||||
macaroon.add_first_party_caveat("time < %d" % (expiry,))
|
||||
macaroon.add_first_party_caveat("time<%d" % (expiry,))
|
||||
|
||||
return macaroon.serialize()
|
||||
|
||||
|
@ -51,16 +51,16 @@ class RegisterTestCase(unittest.TestCase):
|
||||
macaroon = pymacaroons.Macaroon.deserialize(token)
|
||||
|
||||
def verify_gen(caveat):
|
||||
return caveat == "gen = 1"
|
||||
return caveat == "gen=1"
|
||||
|
||||
def verify_user(caveat):
|
||||
return caveat == "user_id = a_user"
|
||||
return caveat == "user_id=a_user"
|
||||
|
||||
def verify_type(caveat):
|
||||
return caveat == "type = access"
|
||||
return caveat == "type=access"
|
||||
|
||||
def verify_expiry(caveat):
|
||||
return caveat == "time < 8600000"
|
||||
return caveat == "time<8600000"
|
||||
|
||||
v = pymacaroons.Verifier()
|
||||
v.satisfy_general(verify_gen)
|
||||
|
Loading…
Reference in New Issue
Block a user