コード例 #1
0
ファイル: agent.py プロジェクト: marslabtron/GitAgent
def verify_request( request ):

    config = get_config()
    if 'password' in config:
        password = config['password']

        method = request.method
        uri = request.path
        request_args = {}
        for name in request.arguments:
            request_args[name] = request.arguments[name][0].decode('utf-8')

        #use password directly auth
        if a.get('password') == password:
            return True

        #use password sign auth
        request_time = int(request_args['time'])
        if abs(request_time - time.time()) > 60:
            return False
        
        sign = request_args['sign']
        del request_args['sign']

        sign_right = auth.sign( method, uri, request_args, password, time_stamp = request_args['time'] )['sign']
        print( 'sign_right:',sign_right )

        if sign_right != sign:
            return False

        return True
コード例 #2
0
def verify_request(request):

    config = get_config()
    if 'password' in config:
        password = config['password']

        method = request.method
        uri = request.path
        request_args = {}
        for name in request.arguments:
            request_args[name] = request.arguments[name][0].decode('utf-8')

        #use password directly auth
        if a.get('password') == password:
            return True

        #use password sign auth
        request_time = int(request_args['time'])
        if abs(request_time - time.time()) > 60:
            return False

        sign = request_args['sign']
        del request_args['sign']

        sign_right = auth.sign(method,
                               uri,
                               request_args,
                               password,
                               time_stamp=request_args['time'])['sign']
        print('sign_right:', sign_right)

        if sign_right != sign:
            return False

        return True
コード例 #3
0
ファイル: client.py プロジェクト: AlainWei/GitAgent
    def request_sign(self, method, uri, args):
        
        if self.password != None:
            args = auth.sign( method, uri, args, self.password )

        return args
コード例 #4
0
ファイル: client.py プロジェクト: zhao9jack/GitAgent
    def request_sign(self, method, uri, args):

        if self.password != None:
            args = auth.sign(method, uri, args, self.password)

        return args