Skip to content

Commit

Permalink
add full outpost support
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
  • Loading branch information
BeryJu committed Oct 23, 2024
1 parent 2d8fc4b commit 46c2724
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 5 deletions.
7 changes: 7 additions & 0 deletions authentik/outposts/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
from authentik.providers.proxy.controllers.kubernetes import ProxyKubernetesController
from authentik.providers.radius.controllers.docker import RadiusDockerController
from authentik.providers.radius.controllers.kubernetes import RadiusKubernetesController
from authentik.providers.scim.controllers.docker import SCIMDockerController
from authentik.providers.scim.controllers.kubernetes import SCIMKubernetesController
from authentik.root.celery import CELERY_APP

LOGGER = get_logger()
Expand Down Expand Up @@ -74,6 +76,11 @@ def controller_for_outpost(outpost: Outpost) -> type[BaseController] | None:
return RACDockerController
if isinstance(service_connection, KubernetesServiceConnection):
return RACKubernetesController
if outpost.type == OutpostType.SCIM:
if isinstance(service_connection, DockerServiceConnection):
return SCIMDockerController
if isinstance(service_connection, KubernetesServiceConnection):
return SCIMKubernetesController
return None


Expand Down
Empty file.
12 changes: 12 additions & 0 deletions authentik/providers/scim/controllers/docker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""SCIM Provider Docker Controller"""

from authentik.outposts.controllers.docker import DockerController
from authentik.outposts.models import DockerServiceConnection, Outpost


class SCIMDockerController(DockerController):
"""SCIM Provider Docker Controller"""

def __init__(self, outpost: Outpost, connection: DockerServiceConnection):
super().__init__(outpost, connection)
self.deployment_ports = []
14 changes: 14 additions & 0 deletions authentik/providers/scim/controllers/kubernetes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""SCIM Provider Kubernetes Controller"""

from authentik.outposts.controllers.k8s.service import ServiceReconciler
from authentik.outposts.controllers.kubernetes import KubernetesController
from authentik.outposts.models import KubernetesServiceConnection, Outpost


class SCIMKubernetesController(KubernetesController):
"""SCIM Provider Kubernetes Controller"""

def __init__(self, outpost: Outpost, connection: KubernetesServiceConnection):
super().__init__(outpost, connection)
self.deployment_ports = []
del self.reconcilers[ServiceReconciler.reconciler_name()]
5 changes: 3 additions & 2 deletions blueprints/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4264,7 +4264,8 @@
"proxy",
"ldap",
"radius",
"rac"
"rac",
"scim"
],
"title": "Type"
},
Expand Down Expand Up @@ -6974,7 +6975,7 @@
"spnego_server_name": {
"type": "string",
"title": "Spnego server name",
"description": "Force the use of a specific server name for SPNEGO"
"description": "Force the use of a specific server name for SPNEGO. Must be in the form HTTP@hostname"
},
"spnego_keytab": {
"type": "string",
Expand Down
10 changes: 7 additions & 3 deletions schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42943,7 +42943,8 @@ components:
readOnly: true
spnego_server_name:
type: string
description: Force the use of a specific server name for SPNEGO
description: Force the use of a specific server name for SPNEGO. Must be
in the form HTTP@hostname
spnego_ccache:
type: string
description: Credential cache to use for SPNEGO in form type:residual
Expand Down Expand Up @@ -43112,7 +43113,8 @@ components:
be in the form TYPE:residual
spnego_server_name:
type: string
description: Force the use of a specific server name for SPNEGO
description: Force the use of a specific server name for SPNEGO. Must be
in the form HTTP@hostname
spnego_keytab:
type: string
writeOnly: true
Expand Down Expand Up @@ -45445,6 +45447,7 @@ components:
- ldap
- radius
- rac
- scim
type: string
PaginatedApplicationList:
type: object
Expand Down Expand Up @@ -48410,7 +48413,8 @@ components:
be in the form TYPE:residual
spnego_server_name:
type: string
description: Force the use of a specific server name for SPNEGO
description: Force the use of a specific server name for SPNEGO. Must be
in the form HTTP@hostname
spnego_keytab:
type: string
writeOnly: true
Expand Down
6 changes: 6 additions & 0 deletions web/src/admin/outposts/OutpostForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ const radiusListFetch = async (page: number, search = "") =>
const racListProvider = async (page: number, search = "") =>
provisionMaker(await api().providersRacList(providerListArgs(page, search)));

const scimListProvider = async (page: number, search = "") =>
provisionMaker(await api().providersScimList(providerListArgs(page, search)));

function providerProvider(type: OutpostTypeEnum): DataProvider {
switch (type) {
case OutpostTypeEnum.Proxy:
Expand All @@ -83,6 +86,8 @@ function providerProvider(type: OutpostTypeEnum): DataProvider {
return radiusListFetch;
case OutpostTypeEnum.Rac:
return racListProvider;
case OutpostTypeEnum.Scim:
return scimListProvider;
default:
throw new Error(`Unrecognized OutputType: ${type}`);
}
Expand Down Expand Up @@ -142,6 +147,7 @@ export class OutpostForm extends ModelForm<Outpost, string> {
[OutpostTypeEnum.Ldap, msg("LDAP")],
[OutpostTypeEnum.Radius, msg("Radius")],
[OutpostTypeEnum.Rac, msg("RAC")],
[OutpostTypeEnum.Scim, msg("SCIM")],
];

return html` <ak-form-element-horizontal label=${msg("Name")} ?required=${true} name="name">
Expand Down

0 comments on commit 46c2724

Please sign in to comment.