2019-07-05 13:21:48 +00:00
|
|
|
"""passbook OAuth2 Provider Forms"""
|
2018-11-26 21:40:10 +00:00
|
|
|
|
|
|
|
from django import forms
|
2020-06-07 14:35:08 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2018-11-26 21:40:10 +00:00
|
|
|
|
2020-06-07 14:35:08 +00:00
|
|
|
from passbook.flows.models import Flow, FlowDesignation
|
2019-10-07 14:33:48 +00:00
|
|
|
from passbook.providers.oauth.models import OAuth2Provider
|
2018-11-26 21:40:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
class OAuth2ProviderForm(forms.ModelForm):
|
|
|
|
"""OAuth2 Provider form"""
|
|
|
|
|
2020-06-07 14:35:08 +00:00
|
|
|
authorization_flow = forms.ModelChoiceField(
|
|
|
|
queryset=Flow.objects.filter(designation=FlowDesignation.AUTHORIZATION)
|
|
|
|
)
|
|
|
|
|
2018-11-26 21:40:10 +00:00
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = OAuth2Provider
|
2019-12-31 11:51:16 +00:00
|
|
|
fields = [
|
|
|
|
"name",
|
2020-06-07 14:35:08 +00:00
|
|
|
"authorization_flow",
|
2019-12-31 11:51:16 +00:00
|
|
|
"redirect_uris",
|
|
|
|
"client_type",
|
|
|
|
"authorization_grant_type",
|
|
|
|
"client_id",
|
|
|
|
"client_secret",
|
|
|
|
]
|
2020-06-07 14:35:08 +00:00
|
|
|
labels = {
|
|
|
|
"client_id": _("Client ID"),
|
|
|
|
"redirect_uris": _("Redirect URIs"),
|
|
|
|
}
|