Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore throttling from clients #4

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,23 @@ jobs:
pip install --upgrade poetry
poetry install
- name: Run tests
run: poetry run coverage run manage.py test --settings=test_settings
- name: Generate and send coveralls report
run: |
pip install --upgrade coveralls
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
poetry run coverage run manage.py test --settings=test_settings
poetry run coverage xml
- name: Generate and send coveralls report
uses: coverallsapp/[email protected]
with:
parallel: true
coverage-reporter-version: v0.6.9
finish:
runs-on: ubuntu-latest
needs: run_tests
steps:
- name: Close parallel build
uses: coverallsapp/[email protected]
with:
parallel-finished: true
coverage-reporter-version: v0.6.9

publish_to_pypi:
# Only run this job if the run_tests job has succeeded, and if
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For the OCS, the authorization server is the Observation Portal.

## Prerequisites

- Python >= 3.7
- Python >= 3.8

## Installation and Getting Started

Expand Down
3 changes: 2 additions & 1 deletion ocs_authentication/auth_profile/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from rest_framework import status

from ocs_authentication.permissions import IsServer
from ocs_authentication.util import create_or_update_user, Profile
from ocs_authentication.util import create_or_update_user, Profile, NoThrottle


class AddUpdateUserView(APIView):
Expand All @@ -15,6 +15,7 @@ class AddUpdateUserView(APIView):
This should also be called on token change or on any user info change.
"""
permission_classes = [IsServer]
throttle_classes = [NoThrottle]

def post(self, request):
data = json.loads(request.body.decode('utf-8'))
Expand Down
6 changes: 6 additions & 0 deletions ocs_authentication/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
import requests
from django.db import transaction
from django.contrib.auth import get_user_model
from rest_framework.throttling import BaseThrottle

from ocs_authentication.settings import ocs_auth_settings
from ocs_authentication.auth_profile.models import AuthProfile
from ocs_authentication.exceptions import ProfileException, OAuthTokenException


class NoThrottle(BaseThrottle):
def allow_request(self, request, view):
return True


@dataclass
class Profile:
"""Dataclass encapsulating profile information"""
Expand Down
Loading
Loading