2012-05-10 19 views
2

私は今では味が非常に親しみやすく、認可と認証と密接に結びついています。django tastypieカスタムログイン

おいしいパイの認証がポップアップするのではなく、承認に使用できる別の場所のページからログインする必要がありますか?

ブラウザを使用していないネイティブアプリの場合、このポップアップがモバイルデバイスに表示される方法をユーザーがログインするように要求します。

それが無断401を言っている

私が試したサンプルコードでは、彼らは決して生産を展開するための許可を使用しないと言うジャンゴ - tastypie公式ドキュメントの

class MyAuthentication(BasicAuthentication): 
    def is_authenticated(self, request, **kwargs): 
     from django.contrib.auth import authenticate 
     #for now i tried static but still not working are return types correct  
     def is_authenticated(self, request, **kwargs): 
      from django.contrib.auth import authenticate 
      user = authenticate(username='admin', password='admin') 

      if user is not None: 
       if user.is_active: 
        return True 
       else: 
       return self._unauthorized() 
      else: 
       return self._unauthorized() 




class EntryResource(ModelResource): 
    class Meta: 
     queryset = Entry.objects.all() 
     resource_name = 'entry' 
     #authorization = Authorization() 
     authorization = DjangoAuthorization() 
     authentication = MyAuthentication() 

    filtering = { 
     'user': ALL_WITH_RELATIONS, 
     'pub_date': ['exact', 'lt', 'lte', 'gte', 'gt'], 
     } 

答えて

1

を下回っているので、そこになければなりませんdjangoauthorizationの回避策になる

関連する問題