-
-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* main: (31 commits) root: support redis username (#8935) core: bump black from 24.2.0 to 24.3.0 (#8945) web: bump the wdio group in /tests/wdio with 2 updates (#8939) web: bump the sentry group in /web with 1 update (#8941) website: bump postcss from 8.4.35 to 8.4.36 in /website (#8940) core: bump twilio from 9.0.1 to 9.0.2 (#8942) core: bump ruff from 0.3.2 to 0.3.3 (#8943) events: discard notification if user has empty email (#8938) ci: always run ci-main on branch pushes (#8950) core: bump goauthentik.io/api/v3 from 3.2024022.2 to 3.2024022.3 (#8946) website/docs: add new name "Microsft Entra ID" for Azure AD (#8930) outposts: Enhance config options for k8s outposts (#7363) website/docs: add link to CRUD docs (#8925) web: bump API Client version (#8927) outpost: improved set secret answers for flow execution (#8013) stages/user_write: ensure user data is json-serializable (#8926) website/docs: update example ldapsearch commands (#8906) admin: Handle latest version unknown in admin dashboard (#8858) core: bump coverage from 7.4.3 to 7.4.4 (#8917) core: bump urllib3 from 1.26.18 to 2.2.1 (#8918) ...
- Loading branch information
Showing
68 changed files
with
1,595 additions
and
440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,6 @@ on: | |
- main | ||
- next | ||
- version-* | ||
paths-ignore: | ||
- website/** | ||
pull_request: | ||
branches: | ||
- main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""Source Stage API Views""" | ||
|
||
from rest_framework.exceptions import ValidationError | ||
from rest_framework.viewsets import ModelViewSet | ||
|
||
from authentik.core.api.used_by import UsedByMixin | ||
from authentik.core.models import Source | ||
from authentik.enterprise.api import EnterpriseRequiredMixin | ||
from authentik.enterprise.stages.source.models import SourceStage | ||
from authentik.flows.api.stages import StageSerializer | ||
|
||
|
||
class SourceStageSerializer(EnterpriseRequiredMixin, StageSerializer): | ||
"""SourceStage Serializer""" | ||
|
||
def validate_source(self, _source: Source) -> Source: | ||
"""Ensure configured source supports web-based login""" | ||
source = Source.objects.filter(pk=_source.pk).select_subclasses().first() | ||
if not source: | ||
raise ValidationError("Invalid source") | ||
login_button = source.ui_login_button(self.context["request"]) | ||
if not login_button: | ||
raise ValidationError("Invalid source selected, only web-based sources are supported.") | ||
return source | ||
|
||
class Meta: | ||
model = SourceStage | ||
fields = StageSerializer.Meta.fields + ["source", "resume_timeout"] | ||
|
||
|
||
class SourceStageViewSet(UsedByMixin, ModelViewSet): | ||
"""SourceStage Viewset""" | ||
|
||
queryset = SourceStage.objects.all() | ||
serializer_class = SourceStageSerializer | ||
filterset_fields = "__all__" | ||
ordering = ["name"] | ||
search_fields = ["name"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"""authentik stage app config""" | ||
|
||
from authentik.enterprise.apps import EnterpriseConfig | ||
|
||
|
||
class AuthentikEnterpriseStageSourceConfig(EnterpriseConfig): | ||
"""authentik source stage config""" | ||
|
||
name = "authentik.enterprise.stages.source" | ||
label = "authentik_stages_source" | ||
verbose_name = "authentik Enterprise.Stages.Source" | ||
default = True |
53 changes: 53 additions & 0 deletions
53
authentik/enterprise/stages/source/migrations/0001_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Generated by Django 5.0.2 on 2024-02-25 20:44 | ||
|
||
import authentik.lib.utils.time | ||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
("authentik_core", "0033_alter_user_options"), | ||
("authentik_flows", "0027_auto_20231028_1424"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="SourceStage", | ||
fields=[ | ||
( | ||
"stage_ptr", | ||
models.OneToOneField( | ||
auto_created=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
parent_link=True, | ||
primary_key=True, | ||
serialize=False, | ||
to="authentik_flows.stage", | ||
), | ||
), | ||
( | ||
"resume_timeout", | ||
models.TextField( | ||
default="minutes=10", | ||
help_text="Amount of time a user can take to return from the source to continue the flow (Format: hours=-1;minutes=-2;seconds=-3)", | ||
validators=[authentik.lib.utils.time.timedelta_string_validator], | ||
), | ||
), | ||
( | ||
"source", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="authentik_core.source" | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Source Stage", | ||
"verbose_name_plural": "Source Stages", | ||
}, | ||
bases=("authentik_flows.stage",), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""Source stage models""" | ||
|
||
from django.db import models | ||
from django.utils.translation import gettext_lazy as _ | ||
from django.views import View | ||
from rest_framework.serializers import BaseSerializer | ||
|
||
from authentik.flows.models import Stage | ||
from authentik.lib.utils.time import timedelta_string_validator | ||
|
||
|
||
class SourceStage(Stage): | ||
"""Suspend the current flow execution and send the user to a source, | ||
after which this flow execution is resumed.""" | ||
|
||
source = models.ForeignKey("authentik_core.Source", on_delete=models.CASCADE) | ||
|
||
resume_timeout = models.TextField( | ||
default="minutes=10", | ||
validators=[timedelta_string_validator], | ||
help_text=_( | ||
"Amount of time a user can take to return from the source to continue the flow " | ||
"(Format: hours=-1;minutes=-2;seconds=-3)" | ||
), | ||
) | ||
|
||
@property | ||
def serializer(self) -> type[BaseSerializer]: | ||
from authentik.enterprise.stages.source.api import SourceStageSerializer | ||
|
||
return SourceStageSerializer | ||
|
||
@property | ||
def view(self) -> type[View]: | ||
from authentik.enterprise.stages.source.stage import SourceStageView | ||
|
||
return SourceStageView | ||
|
||
@property | ||
def component(self) -> str: | ||
return "ak-stage-source-form" | ||
|
||
class Meta: | ||
verbose_name = _("Source Stage") | ||
verbose_name_plural = _("Source Stages") |
Oops, something went wrong.