2

私は今、tastypieにかなり精通しています。これは、承認と認証と緊密に連携しています。

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

ユーザーがログインをリクエストすると、ブラウザーではなくネイティブアプリを使用している場合に、このポップアップがモバイルデバイスにどのように表示されるかが示されます。

401Unauthorizedと言っています

私が試したサンプルコードは以下のとおりです

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'],
        }
4

1 に答える 1

1

django-tastypieの公式ドキュメントでは、本番環境へのデプロイに承認を使用しないと言われているため、djangoauthorizationの回避策が必要です。

于 2012-06-20T17:59:38.187 に答える