Skip to content

Commit 3d45183

Browse files
author
Massimiliano Pippi
committed
removed misleading ALL_IN_ONE response type
1 parent f2c9d20 commit 3d45183

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

oauth2_provider/models.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ class AbstractApplication(models.Model):
4242
(CLIENT_PUBLIC, _('Public')),
4343
)
4444

45-
GRANT_ALLINONE = 'all-in-one'
4645
GRANT_AUTHORIZATION_CODE = 'authorization-code'
4746
GRANT_IMPLICIT = 'implicit'
4847
GRANT_PASSWORD = 'password'
4948
GRANT_CLIENT_CREDENTIALS = 'client-credentials'
5049
GRANT_TYPES = (
51-
(GRANT_ALLINONE, _('All-in-one generic')),
5250
(GRANT_AUTHORIZATION_CODE, _('Authorization code')),
5351
(GRANT_IMPLICIT, _('Implicit')),
5452
(GRANT_PASSWORD, _('Resource owner password-based')),
@@ -96,8 +94,7 @@ def clean(self):
9694
from django.core.exceptions import ValidationError
9795
if not self.redirect_uris \
9896
and self.authorization_grant_type \
99-
in (AbstractApplication.GRANT_ALLINONE,
100-
AbstractApplication.GRANT_AUTHORIZATION_CODE,
97+
in (AbstractApplication.GRANT_AUTHORIZATION_CODE,
10198
AbstractApplication.GRANT_IMPLICIT):
10299
error = _('Redirect_uris could not be empty with {} grant_type')
103100
raise ValidationError(error.format(self.authorization_grant_type))

oauth2_provider/oauth2_validators.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
log = logging.getLogger('oauth2_provider')
1818

1919
GRANT_TYPE_MAPPING = {
20-
'authorization_code': (Application.GRANT_ALLINONE, Application.GRANT_AUTHORIZATION_CODE),
21-
'password': (Application.GRANT_ALLINONE, Application.GRANT_PASSWORD),
22-
'client_credentials': (Application.GRANT_ALLINONE, Application.GRANT_CLIENT_CREDENTIALS),
23-
'refresh_token': (Application.GRANT_ALLINONE, Application.GRANT_AUTHORIZATION_CODE,
24-
Application.GRANT_PASSWORD, Application.GRANT_CLIENT_CREDENTIALS)
20+
'authorization_code': (Application.GRANT_AUTHORIZATION_CODE,),
21+
'password': (Application.GRANT_PASSWORD,),
22+
'client_credentials': (Application.GRANT_CLIENT_CREDENTIALS,),
23+
'refresh_token': (Application.GRANT_AUTHORIZATION_CODE, Application.GRANT_PASSWORD,
24+
Application.GRANT_CLIENT_CREDENTIALS)
2525
}
2626

2727

oauth2_provider/tests/test_models.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,6 @@ def test_allow_scopes(self):
3939
self.assertTrue(access_token.allow_scopes([]))
4040
self.assertFalse(access_token.allow_scopes(['write', 'destroy']))
4141

42-
def test_grant_allinone_redirect_uris(self):
43-
app = Application(
44-
name="test_app",
45-
redirect_uris="",
46-
user=self.user,
47-
client_type=Application.CLIENT_CONFIDENTIAL,
48-
authorization_grant_type=Application.GRANT_ALLINONE,
49-
)
50-
51-
self.assertRaises(ValidationError, app.full_clean)
52-
5342
def test_grant_authorization_code_redirect_uris(self):
5443
app = Application(
5544
name="test_app",

0 commit comments

Comments
 (0)