コード例 #1
0
    def process(self, client, authorized, scopes, redirect_uri, state):
        if not authorized:
            return self.denied_redirect(state=state, redirect_uri=redirect_uri)

        access_token = OAuthAccessToken.objects.create(
            access_token=unicode(uuid.uuid4()), expires_at=OAuthAccessToken.new_expires_at(), client=client
        )
        access_token.scopes.add(*scopes)

        return HttpResponseRedirect(
            "{}#access_token={}&expires_in={}"
            "&token_type=Bearer&state={}".format(
                redirect_uri, access_token.access_token, access_token.expires_in, state
            )
        )
コード例 #2
0
ファイル: granttypes.py プロジェクト: aLosada7/pfc-carlosjg
    def create_access_token(self, client, user=None):
        refresh_token = OAuthRefreshToken.objects.create(
            refresh_token=unicode(uuid.uuid4()),
            expires_at=OAuthRefreshToken.new_expires_at(),
        )

        access_token = OAuthAccessToken.objects.create(
            access_token=unicode(uuid.uuid4()),
            expires_at=OAuthAccessToken.new_expires_at(),
            client=client,
            user=user,
            refresh_token=refresh_token,
        )
        access_token.scopes.add(*self.scopes)

        return access_token
コード例 #3
0
    def create_access_token(self, client, user=None):
        refresh_token = OAuthRefreshToken.objects.create(
            refresh_token=unicode(uuid.uuid4()),
            expires_at=OAuthRefreshToken.new_expires_at(),
        )

        access_token = OAuthAccessToken.objects.create(
            access_token=unicode(uuid.uuid4()),
            expires_at=OAuthAccessToken.new_expires_at(),
            client=client,
            user=user,
            refresh_token=refresh_token,
        )
        access_token.scopes.add(*self.scopes)

        return access_token
コード例 #4
0
    def process(self, client, authorized, scopes, redirect_uri, state):
        if not authorized:
            return self.denied_redirect(state=state, redirect_uri=redirect_uri)

        access_token = OAuthAccessToken.objects.create(
            access_token=unicode(uuid.uuid4()),
            expires_at=OAuthAccessToken.new_expires_at(),
            client=client,
        )
        access_token.scopes.add(*scopes)

        return HttpResponseRedirect('{}#access_token={}&expires_in={}'
                                    '&token_type=Bearer&state={}'.format(
                                        redirect_uri,
                                        access_token.access_token,
                                        access_token.expires_in,
                                        state,
                                    ))