samedi 27 juin 2015

In Django REST / OAuth2 toolkit what is the difference between TokenHasScope and TokenHasReadWriteScope?

In Django REST / OAuth2 toolkit what is the difference between TokenHasScope and TokenHasReadWriteScope?

For example in views.py:

from rest_framework import generics
from django.contrib.auth.models import User
from oauth2_provider.ext.rest_framework import TokenHasReadWriteScope, TokenHasScope
from oauth2.provider.views.mixins import ScopedResourceMixin

class UserView1(viewsets.ModelViewSet):
    permission_classes = [permissions.IsAuthenticated, TokenHasReadWriteScope]
    model = User

class UserView2(ScopedResourceMixin, viewsets.ModelViewSet):
    permission_classes = [permissions.IsAuthenticated, TokenHasScope]
    required_scopes = ['what_is_this']
    model = User

What is the significance of the required_scopes value?

Reference: http://ift.tt/1Ho4RU3

Aucun commentaire:

Enregistrer un commentaire