*: rename objectType to component to get rid of lookup tables
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
		| @ -1,66 +0,0 @@ | |||||||
| """admin tests""" |  | ||||||
| from importlib import import_module |  | ||||||
| from typing import Callable |  | ||||||
|  |  | ||||||
| from django.forms import ModelForm |  | ||||||
| from django.test import Client, TestCase |  | ||||||
| from django.urls import reverse |  | ||||||
| from django.urls.exceptions import NoReverseMatch |  | ||||||
|  |  | ||||||
| from authentik.admin.urls import urlpatterns |  | ||||||
| from authentik.core.models import Group, User |  | ||||||
| from authentik.lib.utils.reflection import get_apps |  | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestAdmin(TestCase): |  | ||||||
|     """Generic admin tests""" |  | ||||||
|  |  | ||||||
|     def setUp(self): |  | ||||||
|         self.user = User.objects.create_user(username="test") |  | ||||||
|         self.user.ak_groups.add(Group.objects.filter(is_superuser=True).first()) |  | ||||||
|         self.user.save() |  | ||||||
|         self.client = Client() |  | ||||||
|         self.client.force_login(self.user) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def generic_view_tester(view_name: str) -> Callable: |  | ||||||
|     """This is used instead of subTest for better visibility""" |  | ||||||
|  |  | ||||||
|     def tester(self: TestAdmin): |  | ||||||
|         try: |  | ||||||
|             full_url = reverse(f"authentik_admin:{view_name}") |  | ||||||
|             response = self.client.get(full_url) |  | ||||||
|             self.assertTrue(response.status_code < 500) |  | ||||||
|         except NoReverseMatch: |  | ||||||
|             pass |  | ||||||
|  |  | ||||||
|     return tester |  | ||||||
|  |  | ||||||
|  |  | ||||||
| for url in urlpatterns: |  | ||||||
|     method_name = url.name.replace("-", "_") |  | ||||||
|     setattr(TestAdmin, f"test_view_{method_name}", generic_view_tester(url.name)) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def generic_form_tester(form: ModelForm) -> Callable: |  | ||||||
|     """Test a form""" |  | ||||||
|  |  | ||||||
|     def tester(self: TestAdmin): |  | ||||||
|         form_inst = form() |  | ||||||
|         self.assertFalse(form_inst.is_valid()) |  | ||||||
|  |  | ||||||
|     return tester |  | ||||||
|  |  | ||||||
|  |  | ||||||
| # Load the forms module from every app, so we have all forms loaded |  | ||||||
| for app in get_apps(): |  | ||||||
|     module = app.__module__.replace(".apps", ".forms") |  | ||||||
|     try: |  | ||||||
|         import_module(module) |  | ||||||
|     except ImportError: |  | ||||||
|         pass |  | ||||||
|  |  | ||||||
| for form_class in ModelForm.__subclasses__(): |  | ||||||
|     setattr( |  | ||||||
|         TestAdmin, f"test_form_{form_class.__name__}", generic_form_tester(form_class) |  | ||||||
|     ) |  | ||||||
| @ -36,11 +36,11 @@ class PropertyMappingTestResultSerializer(PassiveSerializer): | |||||||
| class PropertyMappingSerializer(ManagedSerializer, ModelSerializer, MetaNameSerializer): | class PropertyMappingSerializer(ManagedSerializer, ModelSerializer, MetaNameSerializer): | ||||||
|     """PropertyMapping Serializer""" |     """PropertyMapping Serializer""" | ||||||
|  |  | ||||||
|     object_type = SerializerMethodField() |     component = SerializerMethodField() | ||||||
|  |  | ||||||
|     def get_object_type(self, obj: PropertyMapping) -> str: |     def get_component(self, obj: PropertyMapping) -> str: | ||||||
|         """Get object type so that we know which API Endpoint to use to get the full object""" |         """Get object's component so that we know how to edit the object""" | ||||||
|         return obj._meta.object_name.lower().replace("propertymapping", "") |         return obj.component | ||||||
|  |  | ||||||
|     def validate_expression(self, expression: str) -> str: |     def validate_expression(self, expression: str) -> str: | ||||||
|         """Test Syntax""" |         """Test Syntax""" | ||||||
| @ -56,7 +56,7 @@ class PropertyMappingSerializer(ManagedSerializer, ModelSerializer, MetaNameSeri | |||||||
|             "managed", |             "managed", | ||||||
|             "name", |             "name", | ||||||
|             "expression", |             "expression", | ||||||
|             "object_type", |             "component", | ||||||
|             "verbose_name", |             "verbose_name", | ||||||
|             "verbose_name_plural", |             "verbose_name_plural", | ||||||
|         ] |         ] | ||||||
|  | |||||||
| @ -21,11 +21,11 @@ class ProviderSerializer(ModelSerializer, MetaNameSerializer): | |||||||
|     assigned_application_slug = ReadOnlyField(source="application.slug") |     assigned_application_slug = ReadOnlyField(source="application.slug") | ||||||
|     assigned_application_name = ReadOnlyField(source="application.name") |     assigned_application_name = ReadOnlyField(source="application.name") | ||||||
|  |  | ||||||
|     object_type = SerializerMethodField() |     component = SerializerMethodField() | ||||||
|  |  | ||||||
|     def get_object_type(self, obj):  # pragma: no cover |     def get_component(self, obj: Provider):  # pragma: no cover | ||||||
|         """Get object type so that we know which API Endpoint to use to get the full object""" |         """Get object component so that we know how to edit the object""" | ||||||
|         return obj._meta.object_name.lower().replace("provider", "") |         return obj.component | ||||||
|  |  | ||||||
|     class Meta: |     class Meta: | ||||||
|  |  | ||||||
| @ -35,7 +35,7 @@ class ProviderSerializer(ModelSerializer, MetaNameSerializer): | |||||||
|             "name", |             "name", | ||||||
|             "authorization_flow", |             "authorization_flow", | ||||||
|             "property_mappings", |             "property_mappings", | ||||||
|             "object_type", |             "component", | ||||||
|             "assigned_application_slug", |             "assigned_application_slug", | ||||||
|             "assigned_application_name", |             "assigned_application_name", | ||||||
|             "verbose_name", |             "verbose_name", | ||||||
|  | |||||||
| @ -23,11 +23,11 @@ LOGGER = get_logger() | |||||||
| class SourceSerializer(ModelSerializer, MetaNameSerializer): | class SourceSerializer(ModelSerializer, MetaNameSerializer): | ||||||
|     """Source Serializer""" |     """Source Serializer""" | ||||||
|  |  | ||||||
|     object_type = SerializerMethodField() |     component = SerializerMethodField() | ||||||
|  |  | ||||||
|     def get_object_type(self, obj): |     def get_component(self, obj: Source): | ||||||
|         """Get object type so that we know which API Endpoint to use to get the full object""" |         """Get object component so that we know how to edit the object""" | ||||||
|         return obj._meta.object_name.lower().replace("source", "") |         return obj.component | ||||||
|  |  | ||||||
|     class Meta: |     class Meta: | ||||||
|  |  | ||||||
| @ -39,7 +39,7 @@ class SourceSerializer(ModelSerializer, MetaNameSerializer): | |||||||
|             "enabled", |             "enabled", | ||||||
|             "authentication_flow", |             "authentication_flow", | ||||||
|             "enrollment_flow", |             "enrollment_flow", | ||||||
|             "object_type", |             "component", | ||||||
|             "verbose_name", |             "verbose_name", | ||||||
|             "verbose_name_plural", |             "verbose_name_plural", | ||||||
|             "policy_engine_mode", |             "policy_engine_mode", | ||||||
|  | |||||||
| @ -23,12 +23,15 @@ LOGGER = get_logger() | |||||||
| class StageSerializer(ModelSerializer, MetaNameSerializer): | class StageSerializer(ModelSerializer, MetaNameSerializer): | ||||||
|     """Stage Serializer""" |     """Stage Serializer""" | ||||||
|  |  | ||||||
|     object_type = SerializerMethodField() |     component = SerializerMethodField() | ||||||
|     flow_set = FlowSerializer(many=True, required=False) |     flow_set = FlowSerializer(many=True, required=False) | ||||||
|  |  | ||||||
|     def get_object_type(self, obj: Stage) -> str: |     def get_component(self, obj: Stage) -> str: | ||||||
|         """Get object type so that we know which API Endpoint to use to get the full object""" |         """Get object type so that we know how to edit the object""" | ||||||
|         return obj._meta.object_name.lower().replace("stage", "") |         # pyright: reportGeneralTypeIssues=false | ||||||
|  |         if obj.__class__ == Stage: | ||||||
|  |             return "" | ||||||
|  |         return obj.component | ||||||
|  |  | ||||||
|     class Meta: |     class Meta: | ||||||
|  |  | ||||||
| @ -36,7 +39,7 @@ class StageSerializer(ModelSerializer, MetaNameSerializer): | |||||||
|         fields = [ |         fields = [ | ||||||
|             "pk", |             "pk", | ||||||
|             "name", |             "name", | ||||||
|             "object_type", |             "component", | ||||||
|             "verbose_name", |             "verbose_name", | ||||||
|             "verbose_name_plural", |             "verbose_name_plural", | ||||||
|             "flow_set", |             "flow_set", | ||||||
|  | |||||||
| @ -37,7 +37,7 @@ class TestFlowsAPI(APITestCase): | |||||||
|     def test_api_serializer(self): |     def test_api_serializer(self): | ||||||
|         """Test that stage serializer returns the correct type""" |         """Test that stage serializer returns the correct type""" | ||||||
|         obj = DummyStage() |         obj = DummyStage() | ||||||
|         self.assertEqual(StageSerializer().get_object_type(obj), "dummy") |         self.assertEqual(StageSerializer().get_component(obj), "ak-stage-dummy-form") | ||||||
|         self.assertEqual(StageSerializer().get_verbose_name(obj), "Dummy Stage") |         self.assertEqual(StageSerializer().get_verbose_name(obj), "Dummy Stage") | ||||||
|  |  | ||||||
|     def test_api_viewset(self): |     def test_api_viewset(self): | ||||||
|  | |||||||
| @ -22,7 +22,7 @@ def get_attrs(obj: SerializerModel) -> dict[str, Any]: | |||||||
|         "user", |         "user", | ||||||
|         "verbose_name", |         "verbose_name", | ||||||
|         "verbose_name_plural", |         "verbose_name_plural", | ||||||
|         "object_type", |         "component", | ||||||
|         "flow_set", |         "flow_set", | ||||||
|         "promptstage_set", |         "promptstage_set", | ||||||
|     ) |     ) | ||||||
|  | |||||||
| @ -31,11 +31,11 @@ from authentik.outposts.models import ( | |||||||
| class ServiceConnectionSerializer(ModelSerializer, MetaNameSerializer): | class ServiceConnectionSerializer(ModelSerializer, MetaNameSerializer): | ||||||
|     """ServiceConnection Serializer""" |     """ServiceConnection Serializer""" | ||||||
|  |  | ||||||
|     object_type = SerializerMethodField() |     component = SerializerMethodField() | ||||||
|  |  | ||||||
|     def get_object_type(self, obj: OutpostServiceConnection) -> str: |     def get_component(self, obj: OutpostServiceConnection) -> str: | ||||||
|         """Get object type so that we know which API Endpoint to use to get the full object""" |         """Get object component so that we know how to edit the object""" | ||||||
|         return obj._meta.object_name.lower().replace("serviceconnection", "") |         return obj.component | ||||||
|  |  | ||||||
|     class Meta: |     class Meta: | ||||||
|  |  | ||||||
| @ -44,7 +44,7 @@ class ServiceConnectionSerializer(ModelSerializer, MetaNameSerializer): | |||||||
|             "pk", |             "pk", | ||||||
|             "name", |             "name", | ||||||
|             "local", |             "local", | ||||||
|             "object_type", |             "component", | ||||||
|             "verbose_name", |             "verbose_name", | ||||||
|             "verbose_name_plural", |             "verbose_name_plural", | ||||||
|         ] |         ] | ||||||
|  | |||||||
| @ -33,16 +33,16 @@ class PolicySerializer(ModelSerializer, MetaNameSerializer): | |||||||
|  |  | ||||||
|     _resolve_inheritance: bool |     _resolve_inheritance: bool | ||||||
|  |  | ||||||
|     object_type = SerializerMethodField() |     component = SerializerMethodField() | ||||||
|     bound_to = SerializerMethodField() |     bound_to = SerializerMethodField() | ||||||
|  |  | ||||||
|     def __init__(self, *args, resolve_inheritance: bool = True, **kwargs): |     def __init__(self, *args, resolve_inheritance: bool = True, **kwargs): | ||||||
|         super().__init__(*args, **kwargs) |         super().__init__(*args, **kwargs) | ||||||
|         self._resolve_inheritance = resolve_inheritance |         self._resolve_inheritance = resolve_inheritance | ||||||
|  |  | ||||||
|     def get_object_type(self, obj: Policy) -> str: |     def get_component(self, obj: Policy) -> str: | ||||||
|         """Get object type so that we know which API Endpoint to use to get the full object""" |         """Get object component so that we know how to edit the object""" | ||||||
|         return obj._meta.object_name.lower().replace("policy", "") |         return obj.component | ||||||
|  |  | ||||||
|     def get_bound_to(self, obj: Policy) -> int: |     def get_bound_to(self, obj: Policy) -> int: | ||||||
|         """Return objects policy is bound to""" |         """Return objects policy is bound to""" | ||||||
| @ -65,7 +65,7 @@ class PolicySerializer(ModelSerializer, MetaNameSerializer): | |||||||
|             "pk", |             "pk", | ||||||
|             "name", |             "name", | ||||||
|             "execution_logging", |             "execution_logging", | ||||||
|             "object_type", |             "component", | ||||||
|             "verbose_name", |             "verbose_name", | ||||||
|             "verbose_name_plural", |             "verbose_name_plural", | ||||||
|             "bound_to", |             "bound_to", | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ class DummyPolicy(Policy): | |||||||
|         return DummyPolicySerializer |         return DummyPolicySerializer | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def component(self) -> str: |     def component(self) -> str:  # pragma: no cover | ||||||
|         return "ak-policy-dummy-form" |         return "ak-policy-dummy-form" | ||||||
|  |  | ||||||
|     def passes(self, request: PolicyRequest) -> PolicyResult: |     def passes(self, request: PolicyRequest) -> PolicyResult: | ||||||
|  | |||||||
| @ -0,0 +1,32 @@ | |||||||
|  | # Generated by Django 3.1.7 on 2021-04-03 09:27 | ||||||
|  |  | ||||||
|  | import django.contrib.postgres.fields | ||||||
|  | from django.db import migrations, models | ||||||
|  |  | ||||||
|  | import authentik.stages.authenticator_validate.models | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Migration(migrations.Migration): | ||||||
|  |  | ||||||
|  |     dependencies = [ | ||||||
|  |         ("authentik_stages_authenticator_validate", "0006_auto_20210301_1757"), | ||||||
|  |     ] | ||||||
|  |  | ||||||
|  |     operations = [ | ||||||
|  |         migrations.AlterField( | ||||||
|  |             model_name="authenticatorvalidatestage", | ||||||
|  |             name="device_classes", | ||||||
|  |             field=django.contrib.postgres.fields.ArrayField( | ||||||
|  |                 base_field=models.TextField( | ||||||
|  |                     choices=[ | ||||||
|  |                         ("static", "Static"), | ||||||
|  |                         ("totp", "TOTP"), | ||||||
|  |                         ("webauthn", "WebAuthn"), | ||||||
|  |                     ] | ||||||
|  |                 ), | ||||||
|  |                 default=authentik.stages.authenticator_validate.models.default_device_classes, | ||||||
|  |                 help_text="Device classes which can be used to authenticate", | ||||||
|  |                 size=None, | ||||||
|  |             ), | ||||||
|  |         ), | ||||||
|  |     ] | ||||||
| @ -51,7 +51,7 @@ class AuthenticatorValidateStage(Stage): | |||||||
|     ) |     ) | ||||||
|  |  | ||||||
|     device_classes = ArrayField( |     device_classes = ArrayField( | ||||||
|         models.TextField(), |         models.TextField(choices=DeviceClasses.choices), | ||||||
|         help_text=_("Device classes which can be used to authenticate"), |         help_text=_("Device classes which can be used to authenticate"), | ||||||
|         default=default_device_classes, |         default=default_device_classes, | ||||||
|     ) |     ) | ||||||
|  | |||||||
| @ -73,24 +73,6 @@ class TestUserDeleteStage(TestCase): | |||||||
|             reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}) |             reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}) | ||||||
|         ) |         ) | ||||||
|         self.assertEqual(response.status_code, 200) |         self.assertEqual(response.status_code, 200) | ||||||
|  |  | ||||||
|     def test_user_delete_post(self): |  | ||||||
|         """Test User delete (actual)""" |  | ||||||
|         plan = FlowPlan( |  | ||||||
|             flow_pk=self.flow.pk.hex, stages=[self.stage], markers=[StageMarker()] |  | ||||||
|         ) |  | ||||||
|         plan.context[PLAN_CONTEXT_PENDING_USER] = self.user |  | ||||||
|         session = self.client.session |  | ||||||
|         session[SESSION_KEY_PLAN] = plan |  | ||||||
|         session.save() |  | ||||||
|  |  | ||||||
|         response = self.client.post( |  | ||||||
|             reverse( |  | ||||||
|                 "authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug} |  | ||||||
|             ), |  | ||||||
|             {}, |  | ||||||
|         ) |  | ||||||
|         self.assertEqual(response.status_code, 200) |  | ||||||
|         self.assertJSONEqual( |         self.assertJSONEqual( | ||||||
|             force_str(response.content), |             force_str(response.content), | ||||||
|             {"to": reverse("authentik_core:root-redirect"), "type": "redirect"}, |             {"to": reverse("authentik_core:root-redirect"), "type": "redirect"}, | ||||||
|  | |||||||
							
								
								
									
										169
									
								
								swagger.yaml
									
									
									
									
									
								
							
							
						
						
									
										169
									
								
								swagger.yaml
									
									
									
									
									
								
							| @ -14446,8 +14446,8 @@ definitions: | |||||||
|           type: string |           type: string | ||||||
|           format: uuid |           format: uuid | ||||||
|         uniqueItems: true |         uniqueItems: true | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       assigned_application_slug: |       assigned_application_slug: | ||||||
| @ -15124,8 +15124,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -15274,8 +15274,8 @@ definitions: | |||||||
|           type: string |           type: string | ||||||
|           format: uuid |           format: uuid | ||||||
|         uniqueItems: true |         uniqueItems: true | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       assigned_application_slug: |       assigned_application_slug: | ||||||
| @ -15606,8 +15606,8 @@ definitions: | |||||||
|         description: If enabled, use the local connection. Required Docker socket/Kubernetes |         description: If enabled, use the local connection. Required Docker socket/Kubernetes | ||||||
|           Integration |           Integration | ||||||
|         type: boolean |         type: boolean | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -15650,8 +15650,8 @@ definitions: | |||||||
|         description: If enabled, use the local connection. Required Docker socket/Kubernetes |         description: If enabled, use the local connection. Required Docker socket/Kubernetes | ||||||
|           Integration |           Integration | ||||||
|         type: boolean |         type: boolean | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -15702,8 +15702,8 @@ definitions: | |||||||
|         description: If enabled, use the local connection. Required Docker socket/Kubernetes |         description: If enabled, use the local connection. Required Docker socket/Kubernetes | ||||||
|           Integration |           Integration | ||||||
|         type: boolean |         type: boolean | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -15736,8 +15736,8 @@ definitions: | |||||||
|         description: When this option is enabled, all executions of this policy will |         description: When this option is enabled, all executions of this policy will | ||||||
|           be logged. By default, only execution errors are logged. |           be logged. By default, only execution errors are logged. | ||||||
|         type: boolean |         type: boolean | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -15843,8 +15843,8 @@ definitions: | |||||||
|         description: When this option is enabled, all executions of this policy will |         description: When this option is enabled, all executions of this policy will | ||||||
|           be logged. By default, only execution errors are logged. |           be logged. By default, only execution errors are logged. | ||||||
|         type: boolean |         type: boolean | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -15889,8 +15889,8 @@ definitions: | |||||||
|         description: When this option is enabled, all executions of this policy will |         description: When this option is enabled, all executions of this policy will | ||||||
|           be logged. By default, only execution errors are logged. |           be logged. By default, only execution errors are logged. | ||||||
|         type: boolean |         type: boolean | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -16005,8 +16005,8 @@ definitions: | |||||||
|         description: When this option is enabled, all executions of this policy will |         description: When this option is enabled, all executions of this policy will | ||||||
|           be logged. By default, only execution errors are logged. |           be logged. By default, only execution errors are logged. | ||||||
|         type: boolean |         type: boolean | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -16042,8 +16042,8 @@ definitions: | |||||||
|         description: When this option is enabled, all executions of this policy will |         description: When this option is enabled, all executions of this policy will | ||||||
|           be logged. By default, only execution errors are logged. |           be logged. By default, only execution errors are logged. | ||||||
|         type: boolean |         type: boolean | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -16087,8 +16087,8 @@ definitions: | |||||||
|         description: When this option is enabled, all executions of this policy will |         description: When this option is enabled, all executions of this policy will | ||||||
|           be logged. By default, only execution errors are logged. |           be logged. By default, only execution errors are logged. | ||||||
|         type: boolean |         type: boolean | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -16155,8 +16155,8 @@ definitions: | |||||||
|         description: When this option is enabled, all executions of this policy will |         description: When this option is enabled, all executions of this policy will | ||||||
|           be logged. By default, only execution errors are logged. |           be logged. By default, only execution errors are logged. | ||||||
|         type: boolean |         type: boolean | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -16196,8 +16196,8 @@ definitions: | |||||||
|         description: When this option is enabled, all executions of this policy will |         description: When this option is enabled, all executions of this policy will | ||||||
|           be logged. By default, only execution errors are logged. |           be logged. By default, only execution errors are logged. | ||||||
|         type: boolean |         type: boolean | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -16296,8 +16296,8 @@ definitions: | |||||||
|         title: Expression |         title: Expression | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -16349,8 +16349,8 @@ definitions: | |||||||
|         title: Expression |         title: Expression | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -16394,8 +16394,8 @@ definitions: | |||||||
|         title: Expression |         title: Expression | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -16443,8 +16443,8 @@ definitions: | |||||||
|         title: Expression |         title: Expression | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -16519,8 +16519,8 @@ definitions: | |||||||
|           type: string |           type: string | ||||||
|           format: uuid |           format: uuid | ||||||
|         uniqueItems: true |         uniqueItems: true | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       assigned_application_slug: |       assigned_application_slug: | ||||||
| @ -16602,8 +16602,8 @@ definitions: | |||||||
|           type: string |           type: string | ||||||
|           format: uuid |           format: uuid | ||||||
|         uniqueItems: true |         uniqueItems: true | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       assigned_application_slug: |       assigned_application_slug: | ||||||
| @ -16791,8 +16791,8 @@ definitions: | |||||||
|         type: string |         type: string | ||||||
|         format: uuid |         format: uuid | ||||||
|         x-nullable: true |         x-nullable: true | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -16871,8 +16871,8 @@ definitions: | |||||||
|         type: string |         type: string | ||||||
|         format: uuid |         format: uuid | ||||||
|         x-nullable: true |         x-nullable: true | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17062,8 +17062,8 @@ definitions: | |||||||
|         type: string |         type: string | ||||||
|         format: uuid |         format: uuid | ||||||
|         x-nullable: true |         x-nullable: true | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17186,8 +17186,8 @@ definitions: | |||||||
|         type: string |         type: string | ||||||
|         format: uuid |         format: uuid | ||||||
|         x-nullable: true |         x-nullable: true | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17295,8 +17295,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17338,8 +17338,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17381,8 +17381,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17410,7 +17410,10 @@ definitions: | |||||||
|         items: |         items: | ||||||
|           title: Device classes |           title: Device classes | ||||||
|           type: string |           type: string | ||||||
|           minLength: 1 |           enum: | ||||||
|  |             - static | ||||||
|  |             - totp | ||||||
|  |             - webauthn | ||||||
|       configuration_stage: |       configuration_stage: | ||||||
|         title: Configuration stage |         title: Configuration stage | ||||||
|         description: Stage used to configure Authenticator when user doesn't have |         description: Stage used to configure Authenticator when user doesn't have | ||||||
| @ -17433,8 +17436,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17472,8 +17475,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17512,8 +17515,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17554,8 +17557,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17584,8 +17587,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17614,8 +17617,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17698,8 +17701,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -17990,8 +17993,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -18027,8 +18030,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -18135,8 +18138,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -18177,8 +18180,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -18207,8 +18210,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -18243,8 +18246,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
| @ -18273,8 +18276,8 @@ definitions: | |||||||
|         title: Name |         title: Name | ||||||
|         type: string |         type: string | ||||||
|         minLength: 1 |         minLength: 1 | ||||||
|       object_type: |       component: | ||||||
|         title: Object type |         title: Component | ||||||
|         type: string |         type: string | ||||||
|         readOnly: true |         readOnly: true | ||||||
|       verbose_name: |       verbose_name: | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ import { Table, TableColumn } from "../../elements/table/Table"; | |||||||
|  |  | ||||||
| import "../../elements/forms/DeleteForm"; | import "../../elements/forms/DeleteForm"; | ||||||
| import "../../elements/forms/ModalForm"; | import "../../elements/forms/ModalForm"; | ||||||
|  | import "../../elements/forms/ProxyForm"; | ||||||
| import "./StageBindingForm"; | import "./StageBindingForm"; | ||||||
| import "../../elements/Tabs"; | import "../../elements/Tabs"; | ||||||
| import "../../elements/buttons/ModalButton"; | import "../../elements/buttons/ModalButton"; | ||||||
| @ -15,7 +16,6 @@ import { until } from "lit-html/directives/until"; | |||||||
| import { PAGE_SIZE } from "../../constants"; | import { PAGE_SIZE } from "../../constants"; | ||||||
| import { FlowsApi, FlowStageBinding, StagesApi } from "authentik-api"; | import { FlowsApi, FlowStageBinding, StagesApi } from "authentik-api"; | ||||||
| import { DEFAULT_CONFIG } from "../../api/Config"; | import { DEFAULT_CONFIG } from "../../api/Config"; | ||||||
| import { AdminURLManager } from "../../api/legacy"; |  | ||||||
| import { ifDefined } from "lit-html/directives/if-defined"; | import { ifDefined } from "lit-html/directives/if-defined"; | ||||||
|  |  | ||||||
| @customElement("ak-bound-stages-list") | @customElement("ak-bound-stages-list") | ||||||
| @ -49,12 +49,24 @@ export class BoundStagesList extends Table<FlowStageBinding> { | |||||||
|             html`${item.stageObj?.name}`, |             html`${item.stageObj?.name}`, | ||||||
|             html`${item.stageObj?.verboseName}`, |             html`${item.stageObj?.verboseName}`, | ||||||
|             html` |             html` | ||||||
|             <ak-modal-button href="${AdminURLManager.stages(`${item.stage}/update/`)}"> |             <ak-forms-modal> | ||||||
|                 <ak-spinner-button slot="trigger" class="pf-m-secondary"> |                 <span slot="submit"> | ||||||
|  |                     ${gettext("Update")} | ||||||
|  |                 </span> | ||||||
|  |                 <span slot="header"> | ||||||
|  |                     ${gettext(`Update ${item.stageObj?.verboseName}`)} | ||||||
|  |                 </span> | ||||||
|  |                 <ak-proxy-form | ||||||
|  |                     slot="form" | ||||||
|  |                     .args=${{ | ||||||
|  |                         "stageUUID": item.pk | ||||||
|  |                     }} | ||||||
|  |                     type=${ifDefined(item.stageObj?.component)}> | ||||||
|  |                 </ak-proxy-form> | ||||||
|  |                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||||
|                     ${gettext("Edit Stage")} |                     ${gettext("Edit Stage")} | ||||||
|                 </ak-spinner-button> |                 </button> | ||||||
|                 <div slot="modal"></div> |             </ak-forms-modal> | ||||||
|             </ak-modal-button> |  | ||||||
|             <ak-forms-modal> |             <ak-forms-modal> | ||||||
|                 <span slot="submit"> |                 <span slot="submit"> | ||||||
|                     ${gettext("Update")} |                     ${gettext("Update")} | ||||||
|  | |||||||
| @ -84,11 +84,7 @@ export class OutpostServiceConnectionListPage extends TablePage<ServiceConnectio | |||||||
|                     .args=${{ |                     .args=${{ | ||||||
|                         "scUUID": item.pk |                         "scUUID": item.pk | ||||||
|                     }} |                     }} | ||||||
|                     type=${ifDefined(item.objectType)} |                     type=${ifDefined(item.component)}> | ||||||
|                     .typeMap=${{ |  | ||||||
|                         "docker": "ak-service-connection-docker-form", |  | ||||||
|                         "kubernetes": "ak-service-connection-kubernetes-form" |  | ||||||
|                     }}> |  | ||||||
|                 </ak-proxy-form> |                 </ak-proxy-form> | ||||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> |                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||||
|                     ${gettext("Edit")} |                     ${gettext("Edit")} | ||||||
|  | |||||||
| @ -6,13 +6,12 @@ import { PoliciesApi, PolicyBinding } from "authentik-api"; | |||||||
|  |  | ||||||
| import "../../elements/forms/DeleteForm"; | import "../../elements/forms/DeleteForm"; | ||||||
| import "../../elements/Tabs"; | import "../../elements/Tabs"; | ||||||
| import "../../elements/buttons/ModalButton"; | import "../../elements/forms/ProxyForm"; | ||||||
| import "../../elements/buttons/SpinnerButton"; | import "../../elements/buttons/SpinnerButton"; | ||||||
| import "../../elements/buttons/Dropdown"; | import "../../elements/buttons/Dropdown"; | ||||||
| import { until } from "lit-html/directives/until"; | import { until } from "lit-html/directives/until"; | ||||||
| import { PAGE_SIZE } from "../../constants"; | import { PAGE_SIZE } from "../../constants"; | ||||||
| import { DEFAULT_CONFIG } from "../../api/Config"; | import { DEFAULT_CONFIG } from "../../api/Config"; | ||||||
| import { AdminURLManager } from "../../api/legacy"; |  | ||||||
|  |  | ||||||
| import "../../elements/forms/ModalForm"; | import "../../elements/forms/ModalForm"; | ||||||
| import "../groups/GroupForm"; | import "../groups/GroupForm"; | ||||||
| @ -58,12 +57,25 @@ export class BoundPoliciesList extends Table<PolicyBinding> { | |||||||
|  |  | ||||||
|     getObjectEditButton(item: PolicyBinding): TemplateResult { |     getObjectEditButton(item: PolicyBinding): TemplateResult { | ||||||
|         if (item.policy) { |         if (item.policy) { | ||||||
|             return html`<ak-modal-button href="${AdminURLManager.policies(`${item.policy}/update/`)}"> |             return html` | ||||||
|                 <ak-spinner-button slot="trigger" class="pf-m-secondary"> |             <ak-forms-modal> | ||||||
|                     ${gettext("Edit Policy")} |                 <span slot="submit"> | ||||||
|                 </ak-spinner-button> |                     ${gettext("Update")} | ||||||
|                 <div slot="modal"></div> |                 </span> | ||||||
|             </ak-modal-button>`; |                 <span slot="header"> | ||||||
|  |                     ${gettext(`Update ${item.policyObj?.name}`)} | ||||||
|  |                 </span> | ||||||
|  |                 <ak-proxy-form | ||||||
|  |                     slot="form" | ||||||
|  |                     .args=${{ | ||||||
|  |                         "policyUUID": item.pk | ||||||
|  |                     }} | ||||||
|  |                     type=${ifDefined(item.policyObj?.component)}> | ||||||
|  |                 </ak-proxy-form> | ||||||
|  |                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||||
|  |                     ${gettext("Edit")} | ||||||
|  |                 </button> | ||||||
|  |             </ak-forms-modal>`; | ||||||
|         } else if (item.group) { |         } else if (item.group) { | ||||||
|             return html`<ak-forms-modal> |             return html`<ak-forms-modal> | ||||||
|                 <span slot="submit"> |                 <span slot="submit"> | ||||||
|  | |||||||
| @ -84,16 +84,7 @@ export class PolicyListPage extends TablePage<Policy> { | |||||||
|                     .args=${{ |                     .args=${{ | ||||||
|                         "policyUUID": item.pk |                         "policyUUID": item.pk | ||||||
|                     }} |                     }} | ||||||
|                     type=${ifDefined(item.objectType)} |                     type=${ifDefined(item.component)}> | ||||||
|                     .typeMap=${{ |  | ||||||
|                         "dummy": "ak-policy-dummy-form", |  | ||||||
|                         "eventmatcher": "ak-policy-event-matcher-form", |  | ||||||
|                         "expression": "ak-policy-expression-form", |  | ||||||
|                         "passwordexpiry": "ak-policy-password-expiry-form", |  | ||||||
|                         "haveibeenpwend": "ak-policy-hibp-form", |  | ||||||
|                         "password": "ak-policy-password-form", |  | ||||||
|                         "reputation": "ak-policy-reputation-form", |  | ||||||
|                     }}> |  | ||||||
|                 </ak-proxy-form> |                 </ak-proxy-form> | ||||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> |                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||||
|                     ${gettext("Edit")} |                     ${gettext("Edit")} | ||||||
|  | |||||||
| @ -76,12 +76,7 @@ export class PropertyMappingListPage extends TablePage<PropertyMapping> { | |||||||
|                     .args=${{ |                     .args=${{ | ||||||
|                         "mappingUUID": item.pk |                         "mappingUUID": item.pk | ||||||
|                     }} |                     }} | ||||||
|                     type=${ifDefined(item.objectType)} |                     type=${ifDefined(item.component)}> | ||||||
|                     .typeMap=${{ |  | ||||||
|                         "scopemapping": "ak-property-mapping-scope-form", |  | ||||||
|                         "ldap": "ak-property-mapping-ldap-form", |  | ||||||
|                         "saml": "ak-property-mapping-saml-form", |  | ||||||
|                     }}> |  | ||||||
|                 </ak-proxy-form> |                 </ak-proxy-form> | ||||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> |                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||||
|                     ${gettext("Edit")} |                     ${gettext("Edit")} | ||||||
|  | |||||||
| @ -80,12 +80,7 @@ export class ProviderListPage extends TablePage<Provider> { | |||||||
|                     .args=${{ |                     .args=${{ | ||||||
|                         "providerUUID": item.pk |                         "providerUUID": item.pk | ||||||
|                     }} |                     }} | ||||||
|                     type=${ifDefined(item.objectType)} |                     type=${ifDefined(item.component)}> | ||||||
|                     .typeMap=${{ |  | ||||||
|                         "oauth2": "ak-provider-oauth2-form", |  | ||||||
|                         "saml": "ak-provider-saml-form", |  | ||||||
|                         "proxy": "ak-provider-proxy-form", |  | ||||||
|                     }}> |  | ||||||
|                 </ak-proxy-form> |                 </ak-proxy-form> | ||||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> |                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||||
|                     ${gettext("Edit")} |                     ${gettext("Edit")} | ||||||
|  | |||||||
| @ -36,15 +36,15 @@ export class ProviderViewPage extends LitElement { | |||||||
|         if (!this.provider) { |         if (!this.provider) { | ||||||
|             return html`<ak-empty-state ?loading=${true} ?fullHeight=${true}></ak-empty-state>`; |             return html`<ak-empty-state ?loading=${true} ?fullHeight=${true}></ak-empty-state>`; | ||||||
|         } |         } | ||||||
|         switch (this.provider?.objectType) { |         switch (this.provider?.component) { | ||||||
|             case "saml": |             case "ak-provider-saml-form": | ||||||
|                 return html`<ak-provider-saml-view providerID=${ifDefined(this.provider.pk)}></ak-provider-saml-view>`; |                 return html`<ak-provider-saml-view providerID=${ifDefined(this.provider.pk)}></ak-provider-saml-view>`; | ||||||
|             case "oauth2": |             case "ak-provider-oauth2-form": | ||||||
|                 return html`<ak-provider-oauth2-view providerID=${ifDefined(this.provider.pk)}></ak-provider-oauth2-view>`; |                 return html`<ak-provider-oauth2-view providerID=${ifDefined(this.provider.pk)}></ak-provider-oauth2-view>`; | ||||||
|             case "proxy": |             case "ak-provider-proxy-form": | ||||||
|                 return html`<ak-provider-proxy-view providerID=${ifDefined(this.provider.pk)}></ak-provider-proxy-view>`; |                 return html`<ak-provider-proxy-view providerID=${ifDefined(this.provider.pk)}></ak-provider-proxy-view>`; | ||||||
|             default: |             default: | ||||||
|                 return html`<p>Invalid provider type ${this.provider?.objectType}</p>`; |                 return html`<p>Invalid provider type ${this.provider?.component}</p>`; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -37,15 +37,15 @@ export class SourceViewPage extends LitElement { | |||||||
|         if (!this.source) { |         if (!this.source) { | ||||||
|             return html`<ak-empty-state ?loading=${true} ?fullHeight=${true}></ak-empty-state>`; |             return html`<ak-empty-state ?loading=${true} ?fullHeight=${true}></ak-empty-state>`; | ||||||
|         } |         } | ||||||
|         switch (this.source?.objectType) { |         switch (this.source?.component) { | ||||||
|             case "ldap": |             case "ak-source-ldap-form": | ||||||
|                 return html`<ak-source-ldap-view sourceSlug=${this.source.slug}></ak-source-ldap-view>`; |                 return html`<ak-source-ldap-view sourceSlug=${this.source.slug}></ak-source-ldap-view>`; | ||||||
|             case "oauth": |             case "ak-source-oauth-form": | ||||||
|                 return html`<ak-source-oauth-view sourceSlug=${this.source.slug}></ak-source-oauth-view>`; |                 return html`<ak-source-oauth-view sourceSlug=${this.source.slug}></ak-source-oauth-view>`; | ||||||
|             case "saml": |             case "ak-source-saml-form": | ||||||
|                 return html`<ak-source-saml-view sourceSlug=${this.source.slug}></ak-source-saml-view>`; |                 return html`<ak-source-saml-view sourceSlug=${this.source.slug}></ak-source-saml-view>`; | ||||||
|             default: |             default: | ||||||
|                 return html`<p>Invalid source type ${this.source.objectType}</p>`; |                 return html`<p>Invalid source type ${this.source.component}</p>`; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -73,12 +73,7 @@ export class SourceListPage extends TablePage<Source> { | |||||||
|                     .args=${{ |                     .args=${{ | ||||||
|                         "sourceSlug": item.slug |                         "sourceSlug": item.slug | ||||||
|                     }} |                     }} | ||||||
|                     type=${ifDefined(item.objectType)} |                     type=${ifDefined(item.component)}> | ||||||
|                     .typeMap=${{ |  | ||||||
|                         "ldap": "ak-source-ldap-form", |  | ||||||
|                         "saml": "ak-source-saml-form", |  | ||||||
|                         "oauth": "ak-source-oauth-form", |  | ||||||
|                     }}> |  | ||||||
|                 </ak-proxy-form> |                 </ak-proxy-form> | ||||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> |                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||||
|                     ${gettext("Edit")} |                     ${gettext("Edit")} | ||||||
|  | |||||||
| @ -15,23 +15,23 @@ import { Stage, StagesApi } from "authentik-api"; | |||||||
| import { DEFAULT_CONFIG } from "../../api/Config"; | import { DEFAULT_CONFIG } from "../../api/Config"; | ||||||
| import { ifDefined } from "lit-html/directives/if-defined"; | import { ifDefined } from "lit-html/directives/if-defined"; | ||||||
|  |  | ||||||
| import "./pages/stages/authenticator_static/AuthenticatorStaticStageForm.ts"; | import "./authenticator_static/AuthenticatorStaticStageForm.ts"; | ||||||
| import "./pages/stages/authenticator_totp/AuthenticatorTOTPStageForm.ts"; | import "./authenticator_totp/AuthenticatorTOTPStageForm.ts"; | ||||||
| import "./pages/stages/authenticator_validate/AuthenticatorValidateStageForm.ts"; | import "./authenticator_validate/AuthenticatorValidateStageForm.ts"; | ||||||
| import "./pages/stages/authenticator_webauthn/AuthenticateWebAuthnStageForm.ts"; | import "./authenticator_webauthn/AuthenticateWebAuthnStageForm.ts"; | ||||||
| import "./pages/stages/captcha/CaptchaStageForm.ts"; | import "./captcha/CaptchaStageForm.ts"; | ||||||
| import "./pages/stages/consent/ConsentStageForm.ts"; | import "./consent/ConsentStageForm.ts"; | ||||||
| import "./pages/stages/deny/DenyStageForm.ts"; | import "./deny/DenyStageForm.ts"; | ||||||
| import "./pages/stages/dummy/DummyStageForm.ts"; | import "./dummy/DummyStageForm.ts"; | ||||||
| import "./pages/stages/email/EmailStageForm.ts"; | import "./email/EmailStageForm.ts"; | ||||||
| import "./pages/stages/identification/IdentificationStageForm.ts"; | import "./identification/IdentificationStageForm.ts"; | ||||||
| import "./pages/stages/invitation/InvitationStageForm.ts"; | import "./invitation/InvitationStageForm.ts"; | ||||||
| import "./pages/stages/password/PasswordStageForm.ts"; | import "./password/PasswordStageForm.ts"; | ||||||
| import "./pages/stages/prompt/PromptStageForm.ts"; | import "./prompt/PromptStageForm.ts"; | ||||||
| import "./pages/stages/user_delete/UserDeleteStageForm.ts"; | import "./user_delete/UserDeleteStageForm.ts"; | ||||||
| import "./pages/stages/user_login/UserLoginStageForm.ts"; | import "./user_login/UserLoginStageForm.ts"; | ||||||
| import "./pages/stages/user_logout/UserLogoutStageForm.ts"; | import "./user_logout/UserLogoutStageForm.ts"; | ||||||
| import "./pages/stages/user_write/UserWriteStageForm.ts"; | import "./user_write/UserWriteStageForm.ts"; | ||||||
|  |  | ||||||
| @customElement("ak-stage-list") | @customElement("ak-stage-list") | ||||||
| export class StageListPage extends TablePage<Stage> { | export class StageListPage extends TablePage<Stage> { | ||||||
| @ -92,16 +92,7 @@ export class StageListPage extends TablePage<Stage> { | |||||||
|                     .args=${{ |                     .args=${{ | ||||||
|                         "stageUUID": item.pk |                         "stageUUID": item.pk | ||||||
|                     }} |                     }} | ||||||
|                     type=${ifDefined(item.objectType)} |                     type=${ifDefined(item.component)}> | ||||||
|                     .typeMap=${{ |  | ||||||
|                         "dummy": "ak-policy-dummy-form", |  | ||||||
|                         "eventmatcher": "ak-policy-event-matcher-form", |  | ||||||
|                         "expression": "ak-policy-expression-form", |  | ||||||
|                         "passwordexpiry": "ak-policy-password-expiry-form", |  | ||||||
|                         "haveibeenpwend": "ak-policy-hibp-form", |  | ||||||
|                         "password": "ak-policy-password-form", |  | ||||||
|                         "reputation": "ak-policy-reputation-form", |  | ||||||
|                     }}> |  | ||||||
|                 </ak-proxy-form> |                 </ak-proxy-form> | ||||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> |                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||||
|                     ${gettext("Edit")} |                     ${gettext("Edit")} | ||||||
| @ -148,6 +139,7 @@ export class StageListPage extends TablePage<Stage> { | |||||||
|                                     ${type.name}<br> |                                     ${type.name}<br> | ||||||
|                                     <small>${type.description}</small> |                                     <small>${type.description}</small> | ||||||
|                                 </button> |                                 </button> | ||||||
|  |                             </ak-forms-modal> | ||||||
|                         </li>`; |                         </li>`; | ||||||
|                     }); |                     }); | ||||||
|                 }), html`<ak-spinner></ak-spinner>`)} |                 }), html`<ak-spinner></ak-spinner>`)} | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| import { AuthenticatorValidateStage, AuthenticatorValidateStageNotConfiguredActionEnum, StagesApi } from "authentik-api"; | import { AuthenticatorValidateStage, AuthenticatorValidateStageNotConfiguredActionEnum, AuthenticatorValidateStageDeviceClassesEnum, StagesApi } from "authentik-api"; | ||||||
| import { gettext } from "django"; | import { gettext } from "django"; | ||||||
| import { customElement, property } from "lit-element"; | import { customElement, property } from "lit-element"; | ||||||
| import { html, TemplateResult } from "lit-html"; | import { html, TemplateResult } from "lit-html"; | ||||||
| @ -7,7 +7,6 @@ import { Form } from "../../../elements/forms/Form"; | |||||||
| import { ifDefined } from "lit-html/directives/if-defined"; | import { ifDefined } from "lit-html/directives/if-defined"; | ||||||
| import "../../../elements/forms/HorizontalFormElement"; | import "../../../elements/forms/HorizontalFormElement"; | ||||||
| import "../../../elements/forms/FormGroup"; | import "../../../elements/forms/FormGroup"; | ||||||
| import { DeviceClasses } from "authentik-api/dist/src/flows/stages/authenticator_validate/AuthenticatorValidateStage"; |  | ||||||
| import { until } from "lit-html/directives/until"; | import { until } from "lit-html/directives/until"; | ||||||
|  |  | ||||||
| @customElement("ak-stage-authenticator-validate-form") | @customElement("ak-stage-authenticator-validate-form") | ||||||
| @ -49,7 +48,7 @@ export class AuthenticatorValidateStageForm extends Form<AuthenticatorValidateSt | |||||||
|         } |         } | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     isDeviceClassSelected(field: DeviceClasses): boolean { |     isDeviceClassSelected(field: AuthenticatorValidateStageDeviceClassesEnum): boolean { | ||||||
|         return (this.stage?.deviceClasses || []).filter(isField => { |         return (this.stage?.deviceClasses || []).filter(isField => { | ||||||
|             return field === isField; |             return field === isField; | ||||||
|         }).length > 0; |         }).length > 0; | ||||||
| @ -96,13 +95,13 @@ export class AuthenticatorValidateStageForm extends Form<AuthenticatorValidateSt | |||||||
|                         ?required=${true} |                         ?required=${true} | ||||||
|                         name="transports"> |                         name="transports"> | ||||||
|                         <select name="users" class="pf-c-form-control" multiple> |                         <select name="users" class="pf-c-form-control" multiple> | ||||||
|                             <option value=${DeviceClasses.STATIC} ?selected=${this.isDeviceClassSelected(DeviceClasses.STATIC)}> |                             <option value=${AuthenticatorValidateStageDeviceClassesEnum.Static} ?selected=${this.isDeviceClassSelected(AuthenticatorValidateStageDeviceClassesEnum.Static)}> | ||||||
|                                 ${gettext("Static Tokens")} |                                 ${gettext("Static Tokens")} | ||||||
|                             </option> |                             </option> | ||||||
|                             <option value=${DeviceClasses.TOTP} ?selected=${this.isDeviceClassSelected(DeviceClasses.TOTP)}> |                             <option value=${AuthenticatorValidateStageDeviceClassesEnum.Totp} ?selected=${this.isDeviceClassSelected(AuthenticatorValidateStageDeviceClassesEnum.Totp)}> | ||||||
|                                 ${gettext("TOTP Authenticators")} |                                 ${gettext("TOTP Authenticators")} | ||||||
|                             </option> |                             </option> | ||||||
|                             <option value=${DeviceClasses.WEBAUTHN} ?selected=${this.isDeviceClassSelected(DeviceClasses.WEBAUTHN)}> |                             <option value=${AuthenticatorValidateStageDeviceClassesEnum.Webauthn} ?selected=${this.isDeviceClassSelected(AuthenticatorValidateStageDeviceClassesEnum.Webauthn)}> | ||||||
|                                 ${gettext("WebAuthn Authenticators")} |                                 ${gettext("WebAuthn Authenticators")} | ||||||
|                             </option> |                             </option> | ||||||
|                         </select> |                         </select> | ||||||
| @ -120,8 +119,8 @@ export class AuthenticatorValidateStageForm extends Form<AuthenticatorValidateSt | |||||||
|                                 ordering: "pk", |                                 ordering: "pk", | ||||||
|                             }).then(stages => { |                             }).then(stages => { | ||||||
|                                 return stages.results.map(stage => { |                                 return stages.results.map(stage => { | ||||||
|                                     let selected = this.stage?.configurationStage === stage.pk; |                                     const selected = this.stage?.configurationStage === stage.pk; | ||||||
|                                     return html`<option value=${ifDefined(stage.pk)} ?selected=${selected}>${stage.name} (${stage.objectType})</option>`; |                                     return html`<option value=${ifDefined(stage.pk)} ?selected=${selected}>${stage.name} (${stage.verboseName})</option>`; | ||||||
|                                 }); |                                 }); | ||||||
|                             }))} |                             }))} | ||||||
|                         </select> |                         </select> | ||||||
|  | |||||||
| @ -106,7 +106,7 @@ export class IdentificationStageForm extends Form<IdentificationStage> { | |||||||
|                                 designation: FlowDesignationEnum.Enrollment, |                                 designation: FlowDesignationEnum.Enrollment, | ||||||
|                             }).then(flows => { |                             }).then(flows => { | ||||||
|                                 return flows.results.map(flow => { |                                 return flows.results.map(flow => { | ||||||
|                                     let selected = this.stage?.enrollmentFlow === flow.pk; |                                     const selected = this.stage?.enrollmentFlow === flow.pk; | ||||||
|                                     return html`<option value=${ifDefined(flow.pk)} ?selected=${selected}>${flow.name} (${flow.slug})</option>`; |                                     return html`<option value=${ifDefined(flow.pk)} ?selected=${selected}>${flow.name} (${flow.slug})</option>`; | ||||||
|                                 }); |                                 }); | ||||||
|                             }))} |                             }))} | ||||||
| @ -123,7 +123,7 @@ export class IdentificationStageForm extends Form<IdentificationStage> { | |||||||
|                                 designation: FlowDesignationEnum.Recovery, |                                 designation: FlowDesignationEnum.Recovery, | ||||||
|                             }).then(flows => { |                             }).then(flows => { | ||||||
|                                 return flows.results.map(flow => { |                                 return flows.results.map(flow => { | ||||||
|                                     let selected = this.stage?.recoveryFlow === flow.pk; |                                     const selected = this.stage?.recoveryFlow === flow.pk; | ||||||
|                                     return html`<option value=${ifDefined(flow.pk)} ?selected=${selected}>${flow.name} (${flow.slug})</option>`; |                                     return html`<option value=${ifDefined(flow.pk)} ?selected=${selected}>${flow.name} (${flow.slug})</option>`; | ||||||
|                                 }); |                                 }); | ||||||
|                             }))} |                             }))} | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer