예제 #1
0
    def test_validate_token(self):

        request = self.factory.get(
            self.url, 
            {'state': 'aw1231jass'} #forged token
        )
        request.user = self.user
        view = AuthReturnView(request=request)
        valid = view.validate_token()
        self.assertFalse(valid)
        
        #generate valid token for user
        token = xsrfutil.generate_token(
            settings.SECRET_KEY,
            self.user
        )
        request = self.factory.get(
            self.url, 
            {'state': token} #valid token
        )
        request.user = self.user
        view = AuthReturnView(request=request)
        valid = view.validate_token()
        self.assertTrue(valid)
예제 #2
0
    def test_validate_token(self):

        request = self.factory.get(
            self.url,
            {'state': 'aw1231jass'}  #forged token
        )
        request.user = self.user
        view = AuthReturnView(request=request)
        valid = view.validate_token()
        self.assertFalse(valid)

        #generate valid token for user
        token = xsrfutil.generate_token(settings.SECRET_KEY, self.user)
        request = self.factory.get(
            self.url,
            {'state': token}  #valid token
        )
        request.user = self.user
        view = AuthReturnView(request=request)
        valid = view.validate_token()
        self.assertTrue(valid)
예제 #3
0
 def initiate_view(self):
     view = AuthReturnView(request=self.request)
     return view
예제 #4
0
from django.conf.urls.defaults import patterns, include, url
from google_oauth.views import AuthCredentials, AuthReturnView

urlpatterns = patterns(
    '',
    url(r'^$', AuthCredentials.as_view(), name="google_auth"),
    url(r'^oauth2callback',
        AuthReturnView.as_view(),
        name="google_auth_return"),
)
예제 #5
0
from django.conf.urls.defaults import patterns, include, url
from google_oauth.views import AuthCredentials, AuthReturnView


urlpatterns = patterns(
    "",
    url(r"^$", AuthCredentials.as_view(), name="google_auth"),
    url(r"^oauth2callback", AuthReturnView.as_view(), name="google_auth_return"),
)
예제 #6
0
from django.conf.urls import patterns, include, url
from google_oauth.views import AuthCredentials, AuthReturnView


urlpatterns = patterns('',
    url(r'^$', AuthCredentials.as_view(), 
        name="google_auth"),
    url(r'^oauth2callback', AuthReturnView.as_view(), 
        name="google_auth_return"),
)