udata
udata copied to clipboard
Authlib checks returning true
In the OAuth2Client class, the checks uses by Authlib on the grant type and response type always return True
.
We should implement them as following:
def check_response_type(self, response_type):
return response_type in self.response_types
def check_grant_type(self, grant_type):
return grant_type in self.grant_types
Creating a client as following:
OAuth2Client.objects.create(
name='test-client',
owner=UserFactory(),
redirect_uris=['https://test.org/callback'],
grant_types=['authorization_code', 'client_credentials', 'refresh_token', 'password'],
response_types=['code'],
**kwargs
)
The drawback is that it would require a migration for the existing OAuth clients.