providers/app_gw: use full URL with protocol for internal/external_host

This commit is contained in:
Jens Langhammer 2020-07-26 22:00:32 +02:00
parent 7221800a16
commit 83205f1b49
3 changed files with 29 additions and 4 deletions

View File

@ -0,0 +1,24 @@
# Generated by Django 3.0.8 on 2020-07-26 17:45
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("passbook_providers_app_gw", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="applicationgatewayprovider",
name="external_host",
field=models.TextField(validators=[django.core.validators.URLValidator]),
),
migrations.AlterField(
model_name="applicationgatewayprovider",
name="internal_host",
field=models.TextField(validators=[django.core.validators.URLValidator]),
),
]

View File

@ -3,6 +3,7 @@ import string
from random import SystemRandom from random import SystemRandom
from typing import Optional, Type from typing import Optional, Type
from django.core.validators import URLValidator
from django.db import models from django.db import models
from django.forms import ModelForm from django.forms import ModelForm
from django.http import HttpRequest from django.http import HttpRequest
@ -20,8 +21,8 @@ class ApplicationGatewayProvider(Provider):
Protocols by using a Reverse-Proxy.""" Protocols by using a Reverse-Proxy."""
name = models.TextField() name = models.TextField()
internal_host = models.TextField() internal_host = models.TextField(validators=[URLValidator])
external_host = models.TextField() external_host = models.TextField(validators=[URLValidator])
client = models.ForeignKey(Client, on_delete=models.CASCADE) client = models.ForeignKey(Client, on_delete=models.CASCADE)

View File

@ -49,8 +49,8 @@
<a href="{% url 'passbook_providers_app_gw:k8s-manifest' provider=provider.pk %}">{% trans 'Here' %}</a> <a href="{% url 'passbook_providers_app_gw:k8s-manifest' provider=provider.pk %}">{% trans 'Here' %}</a>
<p>{% trans 'Afterwards, add the following annotations to the Ingress you want to secure:' %}</p> <p>{% trans 'Afterwards, add the following annotations to the Ingress you want to secure:' %}</p>
<textarea class="codemirror" readonly data-cm-mode="yaml"> <textarea class="codemirror" readonly data-cm-mode="yaml">
nginx.ingress.kubernetes.io/auth-url: "https://{{ provider.external_host }}/oauth2/auth" nginx.ingress.kubernetes.io/auth-url: "{{ provider.external_host }}/oauth2/auth"
nginx.ingress.kubernetes.io/auth-signin: "https://{{ provider.external_host }}/oauth2/start?rd=$escaped_request_uri" nginx.ingress.kubernetes.io/auth-signin: "{{ provider.external_host }}/oauth2/start?rd=$escaped_request_uri"
</textarea> </textarea>
</div> </div>
<footer class="pf-c-modal-box__footer pf-m-align-left"> <footer class="pf-c-modal-box__footer pf-m-align-left">