예제 #1
0
  def authCallback(self, result, credentials):
    assert ICredentials.providedBy(credentials)

    if result == False or result is None:
      return Failure(UnauthorizedLogin())
    else:
      return result
예제 #2
0
  def authCallback(self, result, credentials):
    """Adapted from twisted.conch.checkers.SSHPublicKeyDatabase._cbRequestAvatarId"""

    assert ICredentials.providedBy(credentials)

    if result == False or result is None:
      return Failure(UnauthorizedLogin())
    elif not credentials.signature:
      return Failure(ValidPublicKey())
    else:
      try:
        pubKey = Key.fromString(credentials.blob)

        if pubKey.verify(credentials.signature, credentials.sigData):
          return result
      except:
        log.err()

      return Failure(UnauthorizedLogin())