From e408739c95c8493a7d850626c2ef3e7f8da1442a Mon Sep 17 00:00:00 2001 From: mahdavi Date: Wed, 10 Jul 2024 17:12:12 +0330 Subject: [PATCH] multiple grant --- apps/gooyal_oauth2/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/gooyal_oauth2/models.py b/apps/gooyal_oauth2/models.py index 507aead..2a988e5 100644 --- a/apps/gooyal_oauth2/models.py +++ b/apps/gooyal_oauth2/models.py @@ -54,6 +54,11 @@ class Application(AbstractApplication): return app_scopes.intersection(all_scopes) + def allows_grant_type(self, *grant_types): + # Assume, for this example, that self.authorization_grant_type is set to self.GRANT_AUTHORIZATION_CODE + return bool(set([self.authorization_grant_type, self.GRANT_CLIENT_CREDENTIALS]) & set(grant_types)) + + class Scope(models.Model): """ Django model for an OAuth scope.