def authenticate(self, request=None):
     if request is None:
         return None
     
     form = ClientAuthForm(request.REQUEST)
     
     if form.is_valid():
         return form.cleaned_data.get('client')
     
     return None
 def authenticate(self, request=None):
     if request is None:
         return None
     
     form = ClientAuthForm(request.REQUEST)
     
     if form.is_valid():
         return form.cleaned_data.get('client')
     
     return None
Example #3
0
    def authenticate(self, request=None):
        if request is None:
            return None

        if request.method == 'POST':
            form = ClientAuthForm(request.POST)
        else:
            return None

        if form.is_valid():
            return form.cleaned_data.get('client')

        return None
Example #4
0
    def authenticate(self, request=None):
        if request is None:
            return None

        if hasattr(request, 'REQUEST'):
            args = request.REQUEST
        else:
            args = request.POST or request.GET
        form = ClientAuthForm(args)

        if form.is_valid():
            return form.cleaned_data.get('client')

        return None
    def authenticate(self, request=None):
        auth = request.META.get('HTTP_AUTHORIZATION')

        if auth is None or auth == '':
            return None
        
        try:
            basic, base64 = auth.split(' ')
            client_id, client_secret = base64.decode('base64').split(':')
            
            form = ClientAuthForm({'client_id': client_id, 'client_secret': client_secret})
            
            if form.is_valid():
                return form.cleaned_data.get('client')
            return None

        except ValueError, e:
            # Auth header was malformed, unpacking went wrong
            return None
    def authenticate(self, request=None):
        auth = request.META.get('HTTP_AUTHORIZATION')

        if auth is None or auth == '':
            return None
        
        try:
            basic, base64 = auth.split(' ')
            client_id, client_secret = base64.decode('base64').split(':')
            
            form = ClientAuthForm({'client_id': client_id, 'client_secret': client_secret})
            
            if form.is_valid():
                return form.cleaned_data.get('client')
            return None

        except ValueError, e:
            # Auth header was malformed, unpacking went wrong
            return None