Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #91 from uw-it-aca/hotfix/client-credentials
Browse files Browse the repository at this point in the history
Adding support for client credential oauth clients
  • Loading branch information
vegitron committed May 8, 2017
2 parents 4ab8b94 + dfb3f2e commit ac3f8d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sqlshare_rest/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ def get_oauth_user(request):
request=request):
raise Exception("Invalid token - no user")

if "client-credentials" == request.client.authorization_grant_type:
request.user = request.client.user

if not request.user:
raise Exception("Invalid token - no user")

Expand Down
2 changes: 2 additions & 0 deletions sqlshare_rest/views/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ class SSRegistrationForm(forms.ModelForm):
"""
GRANT_AUTHORIZATION_CODE = 'authorization-code'
GRANT_IMPLICIT = 'implicit'
GRANT_CLIENT_CREDENTIALS = 'client-credentials'
GRANT_TYPES = (
(GRANT_AUTHORIZATION_CODE, 'Authorization code'),
(GRANT_IMPLICIT, 'Implicit'),
(GRANT_CLIENT_CREDENTIALS, 'Client credentials'),
)

# Limit the allowed grant types
Expand Down

0 comments on commit ac3f8d8

Please sign in to comment.