diff --git a/passbook/providers/proxy/migrations/0008_auto_20200930_0810.py b/passbook/providers/proxy/migrations/0008_auto_20200930_0810.py index e221c442f..9ab9e09b8 100644 --- a/passbook/providers/proxy/migrations/0008_auto_20200930_0810.py +++ b/passbook/providers/proxy/migrations/0008_auto_20200930_0810.py @@ -39,28 +39,40 @@ class Migration(migrations.Migration): operations = [ migrations.AlterField( - model_name='proxyprovider', - name='internal_host_ssl_validation', + model_name="proxyprovider", + name="internal_host_ssl_validation", field=models.BooleanField( - default=True, help_text='Validate SSL Certificates of upstream servers', verbose_name='Internal host SSL Validation'), + default=True, + help_text="Validate SSL Certificates of upstream servers", + verbose_name="Internal host SSL Validation", + ), ), migrations.AddField( - model_name='proxyprovider', - name='basic_auth_enabled', + model_name="proxyprovider", + name="basic_auth_enabled", field=models.BooleanField( - default=False, help_text='Set a custom HTTP-Basic Authentication header based on values from passbook.', verbose_name='Set HTTP-Basic Authentication'), + default=False, + help_text="Set a custom HTTP-Basic Authentication header based on values from passbook.", + verbose_name="Set HTTP-Basic Authentication", + ), ), migrations.AddField( - model_name='proxyprovider', - name='basic_auth_password_attribute', + model_name="proxyprovider", + name="basic_auth_password_attribute", field=models.TextField( - blank=True, help_text='User Attribute used for the password part of the HTTP-Basic Header.', verbose_name='HTTP-Basic Password'), + blank=True, + help_text="User Attribute used for the password part of the HTTP-Basic Header.", + verbose_name="HTTP-Basic Password", + ), ), migrations.AddField( - model_name='proxyprovider', - name='basic_auth_user_attribute', + model_name="proxyprovider", + name="basic_auth_user_attribute", field=models.TextField( - blank=True, help_text="User Attribute used for the user part of the HTTP-Basic Header. If not set, the user's Email address is used.", verbose_name='HTTP-Basic Username'), + blank=True, + help_text="User Attribute used for the user part of the HTTP-Basic Header. If not set, the user's Email address is used.", + verbose_name="HTTP-Basic Username", + ), ), migrations.RunPython(create_proxy_scope), ] diff --git a/passbook/providers/proxy/models.py b/passbook/providers/proxy/models.py index 9d0c23eb8..6f6c865db 100644 --- a/passbook/providers/proxy/models.py +++ b/passbook/providers/proxy/models.py @@ -1,11 +1,12 @@ """passbook proxy models""" import string from random import SystemRandom -from typing import Iterable, Type +from typing import Iterable, Optional, Type from urllib.parse import urljoin from django.db import models from django.forms import ModelForm +from django.http import HttpRequest from django.utils.translation import gettext as _ from passbook.crypto.models import CertificateKeyPair @@ -49,7 +50,9 @@ class ProxyProvider(OutpostModel, OAuth2Provider): validators=[DomainlessURLValidator(schemes=("http", "https"))] ) internal_host_ssl_validation = models.BooleanField( - default=True, help_text=_("Validate SSL Certificates of upstream servers") + default=True, + help_text=_("Validate SSL Certificates of upstream servers"), + verbose_name=_("Internal host SSL Validation"), ) skip_path_regex = models.TextField( @@ -75,6 +78,15 @@ class ProxyProvider(OutpostModel, OAuth2Provider): return ProxyProviderForm + @property + def launch_url(self) -> Optional[str]: + """Use external_host as launch URL""" + return self.external_host + + def html_setup_urls(self, request: HttpRequest) -> Optional[str]: + """Overwrite Setup URLs as they are not needed for proxy""" + return None + def set_oauth_defaults(self): """Ensure all OAuth2-related settings are correct""" self.client_type = ClientTypes.CONFIDENTIAL