switch to text field, add debug mode
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
edccf3331a
commit
41387e413f
|
@ -45,7 +45,7 @@ class Migration(migrations.Migration):
|
||||||
default="number_matching_3",
|
default="number_matching_3",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
("cgw_endpoint", models.URLField()),
|
("cgw_endpoint", models.TextField()),
|
||||||
(
|
(
|
||||||
"configure_flow",
|
"configure_flow",
|
||||||
models.ForeignKey(
|
models.ForeignKey(
|
||||||
|
|
|
@ -50,7 +50,7 @@ class AuthenticatorMobileStage(ConfigurableStage, FriendlyNamedStage, Stage):
|
||||||
item_matching_mode = models.TextField(
|
item_matching_mode = models.TextField(
|
||||||
choices=ItemMatchingMode.choices, default=ItemMatchingMode.NUMBER_MATCHING_3
|
choices=ItemMatchingMode.choices, default=ItemMatchingMode.NUMBER_MATCHING_3
|
||||||
)
|
)
|
||||||
cgw_endpoint = models.URLField()
|
cgw_endpoint = models.TextField()
|
||||||
|
|
||||||
def create_transaction(self, device: "MobileDevice") -> "MobileTransaction":
|
def create_transaction(self, device: "MobileDevice") -> "MobileTransaction":
|
||||||
"""Create a transaction for `device` with the config of this stage."""
|
"""Create a transaction for `device` with the config of this stage."""
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Mobile stage"""
|
"""Mobile stage"""
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from rest_framework.fields import CharField
|
from rest_framework.fields import CharField
|
||||||
|
from django.conf import settings
|
||||||
from authentik.core.api.utils import PassiveSerializer
|
from authentik.core.api.utils import PassiveSerializer
|
||||||
from authentik.flows.challenge import (
|
from authentik.flows.challenge import (
|
||||||
Challenge,
|
Challenge,
|
||||||
|
@ -65,10 +65,13 @@ class AuthenticatorMobileStageView(ChallengeStageView):
|
||||||
|
|
||||||
def get_challenge(self, *args, **kwargs) -> Challenge:
|
def get_challenge(self, *args, **kwargs) -> Challenge:
|
||||||
self.prepare()
|
self.prepare()
|
||||||
|
endpoint = f"https://{self.executor.current_stage.cgw_endpoint}/"
|
||||||
|
if settings.DEBUG:
|
||||||
|
endpoint = endpoint.replace(":3415", ":3416")
|
||||||
|
endpoint = endpoint.replace("https", "http")
|
||||||
payload = AuthenticatorMobilePayloadChallenge(
|
payload = AuthenticatorMobilePayloadChallenge(
|
||||||
data={
|
data={
|
||||||
# TODO: use cloud gateway?
|
"u": endpoint,
|
||||||
"u": self.request.build_absolute_uri("/"),
|
|
||||||
"s": str(self.executor.plan.context[FLOW_PLAN_MOBILE_ENROLL_DEVICE].pk),
|
"s": str(self.executor.plan.context[FLOW_PLAN_MOBILE_ENROLL_DEVICE].pk),
|
||||||
"t": self.executor.plan.context[FLOW_PLAN_MOBILE_ENROLL_TOKEN].token,
|
"t": self.executor.plan.context[FLOW_PLAN_MOBILE_ENROLL_TOKEN].token,
|
||||||
}
|
}
|
||||||
|
|
|
@ -6155,8 +6155,6 @@
|
||||||
},
|
},
|
||||||
"cgw_endpoint": {
|
"cgw_endpoint": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "uri",
|
|
||||||
"maxLength": 200,
|
|
||||||
"minLength": 1,
|
"minLength": 1,
|
||||||
"title": "Cgw endpoint"
|
"title": "Cgw endpoint"
|
||||||
}
|
}
|
||||||
|
|
|
@ -30429,8 +30429,6 @@ components:
|
||||||
$ref: '#/components/schemas/ItemMatchingModeEnum'
|
$ref: '#/components/schemas/ItemMatchingModeEnum'
|
||||||
cgw_endpoint:
|
cgw_endpoint:
|
||||||
type: string
|
type: string
|
||||||
format: uri
|
|
||||||
maxLength: 200
|
|
||||||
required:
|
required:
|
||||||
- cgw_endpoint
|
- cgw_endpoint
|
||||||
- component
|
- component
|
||||||
|
@ -30464,9 +30462,7 @@ components:
|
||||||
$ref: '#/components/schemas/ItemMatchingModeEnum'
|
$ref: '#/components/schemas/ItemMatchingModeEnum'
|
||||||
cgw_endpoint:
|
cgw_endpoint:
|
||||||
type: string
|
type: string
|
||||||
format: uri
|
|
||||||
minLength: 1
|
minLength: 1
|
||||||
maxLength: 200
|
|
||||||
required:
|
required:
|
||||||
- cgw_endpoint
|
- cgw_endpoint
|
||||||
- name
|
- name
|
||||||
|
@ -38236,9 +38232,7 @@ components:
|
||||||
$ref: '#/components/schemas/ItemMatchingModeEnum'
|
$ref: '#/components/schemas/ItemMatchingModeEnum'
|
||||||
cgw_endpoint:
|
cgw_endpoint:
|
||||||
type: string
|
type: string
|
||||||
format: uri
|
|
||||||
minLength: 1
|
minLength: 1
|
||||||
maxLength: 200
|
|
||||||
PatchedAuthenticatorSMSStageRequest:
|
PatchedAuthenticatorSMSStageRequest:
|
||||||
type: object
|
type: object
|
||||||
description: AuthenticatorSMSStage Serializer
|
description: AuthenticatorSMSStage Serializer
|
||||||
|
|
Reference in New Issue