Changeset 6c756ba in trunk
- Timestamp:
- 2015-01-06T18:10:41Z (10 years ago)
- Branches:
- master
- Children:
- 6194ab9
- Parents:
- 102d581
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/allmydata/frontends/auth.py ¶
r102d581 r6c756ba 83 83 return d 84 84 85 def _allowedKey(self, creds):86 """87 Determine whether the public key indicated by the given credentials is88 one allowed to authenticate the username in those credentials.89 90 Returns True if so, False otherwise.91 """92 return creds.blob == self.pubkeys.get(creds.username)93 94 def _correctSignature(self, creds):95 """96 Determine whether the signature in the given credentials is the correct97 signature for the data in those credentials.98 99 Returns True if so, False otherwise.100 """101 key = keys.Key.fromString(creds.blob)102 return key.verify(creds.signature, creds.sigData)103 104 85 def _checkKey(self, creds): 105 86 """ … … 110 91 UnauthorizedLogin failure otherwise. 111 92 """ 112 if self._allowedKey(creds): 93 94 # Is the public key indicated by the given credentials allowed to 95 # authenticate the username in those credentials? 96 if creds.blob == self.pubkeys.get(creds.username): 113 97 if creds.signature is None: 114 98 return defer.fail(conch_error.ValidPublicKey()) 115 if self._correctSignature(creds): 99 100 # Is the signature in the given credentials the correct 101 # signature for the data in those credentials? 102 key = keys.Key.fromString(creds.blob) 103 if key.verify(creds.signature, creds.sigData): 116 104 return defer.succeed(self._avatarId(creds.username)) 105 117 106 return defer.fail(error.UnauthorizedLogin()) 118 107
Note: See TracChangeset
for help on using the changeset viewer.