providers/app_gw: separate host field into external_ and internal_
This commit is contained in:
parent
c3a4a76d43
commit
cd34413914
|
@ -20,8 +20,10 @@ class ApplicationGatewayProviderForm(forms.ModelForm):
|
||||||
"code"
|
"code"
|
||||||
)
|
)
|
||||||
self.instance.client.redirect_uris = [
|
self.instance.client.redirect_uris = [
|
||||||
f"http://{self.instance.host}/oauth2/callback",
|
f"http://{self.instance.external_host}/oauth2/callback",
|
||||||
f"https://{self.instance.host}/oauth2/callback",
|
f"https://{self.instance.external_host}/oauth2/callback",
|
||||||
|
f"http://{self.instance.internal_host}/oauth2/callback",
|
||||||
|
f"https://{self.instance.internal_host}/oauth2/callback",
|
||||||
]
|
]
|
||||||
self.instance.client.scope = ["openid", "email"]
|
self.instance.client.scope = ["openid", "email"]
|
||||||
self.instance.client.save()
|
self.instance.client.save()
|
||||||
|
@ -30,8 +32,9 @@ class ApplicationGatewayProviderForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
model = ApplicationGatewayProvider
|
model = ApplicationGatewayProvider
|
||||||
fields = ["name", "host"]
|
fields = ["name", "internal_host", "external_host"]
|
||||||
widgets = {
|
widgets = {
|
||||||
"name": forms.TextInput(),
|
"name": forms.TextInput(),
|
||||||
"host": forms.TextInput(),
|
"internal_host": forms.TextInput(),
|
||||||
|
"external_host": forms.TextInput(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Generated by Django 2.2.9 on 2020-01-02 15:05
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("passbook_providers_app_gw", "0003_applicationgatewayprovider"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="applicationgatewayprovider",
|
||||||
|
old_name="host",
|
||||||
|
new_name="external_host",
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="applicationgatewayprovider",
|
||||||
|
name="internal_host",
|
||||||
|
field=models.TextField(default=""),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
|
@ -14,7 +14,8 @@ class ApplicationGatewayProvider(Provider):
|
||||||
"""This provider uses oauth2_proxy with the OIDC Provider."""
|
"""This provider uses oauth2_proxy with the OIDC Provider."""
|
||||||
|
|
||||||
name = models.TextField()
|
name = models.TextField()
|
||||||
host = models.TextField()
|
internal_host = models.TextField()
|
||||||
|
external_host = models.TextField()
|
||||||
|
|
||||||
client = models.ForeignKey(Client, on_delete=models.CASCADE)
|
client = models.ForeignKey(Client, on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,10 @@ services:
|
||||||
environment:
|
environment:
|
||||||
OAUTH2_PROXY_CLIENT_ID: {{ provider.client.client_id }}
|
OAUTH2_PROXY_CLIENT_ID: {{ provider.client.client_id }}
|
||||||
OAUTH2_PROXY_CLIENT_SECRET: {{ provider.client.client_secret }}
|
OAUTH2_PROXY_CLIENT_SECRET: {{ provider.client.client_secret }}
|
||||||
OAUTH2_PROXY_REDIRECT_URL: https://{{ provider.host }}/oauth2/callback
|
|
||||||
OAUTH2_PROXY_OIDC_ISSUER_URL: https://{{ request.META.host }}/application/oidc
|
OAUTH2_PROXY_OIDC_ISSUER_URL: https://{{ request.META.host }}/application/oidc
|
||||||
|
OAUTH2_PROXY_REDIRECT_URL: https://{{ provider.external_host }}/oauth2/callback
|
||||||
OAUTH2_PROXY_COOKIE_SECRET: {{ cookie_secret }}
|
OAUTH2_PROXY_COOKIE_SECRET: {{ cookie_secret }}
|
||||||
OAUTH2_PROXY_UPSTREAM: http://{{ provider.host }}</textarea>
|
OAUTH2_PROXY_UPSTREAM: http://{{ provider.internal_host }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-primary" data-dismiss="modal">{% trans 'Close' %}</button>
|
<button type="button" class="btn btn-primary" data-dismiss="modal">{% trans 'Close' %}</button>
|
||||||
|
|
Reference in a new issue