providers/app_gw: fix Client's response_type not being set

This commit is contained in:
Jens Langhammer 2020-01-02 16:06:32 +01:00
parent a59a29b256
commit c3a4a76d43

View file

@ -1,7 +1,7 @@
"""passbook Application Security Gateway Forms""" """passbook Application Security Gateway Forms"""
from django import forms from django import forms
from oauth2_provider.generators import generate_client_id, generate_client_secret from oauth2_provider.generators import generate_client_id, generate_client_secret
from oidc_provider.models import Client from oidc_provider.models import Client, ResponseType
from passbook.providers.app_gw.models import ApplicationGatewayProvider from passbook.providers.app_gw.models import ApplicationGatewayProvider
@ -16,6 +16,9 @@ class ApplicationGatewayProviderForm(forms.ModelForm):
client_id=generate_client_id(), client_secret=generate_client_secret() client_id=generate_client_id(), client_secret=generate_client_secret()
) )
self.instance.client.name = self.instance.name self.instance.client.name = self.instance.name
self.instance.client.response_types = ResponseType.objects.get_by_natural_key(
"code"
)
self.instance.client.redirect_uris = [ self.instance.client.redirect_uris = [
f"http://{self.instance.host}/oauth2/callback", f"http://{self.instance.host}/oauth2/callback",
f"https://{self.instance.host}/oauth2/callback", f"https://{self.instance.host}/oauth2/callback",