authentik.endpoints.connectors.agent.schema

 1from drf_spectacular.extensions import OpenApiAuthenticationExtension
 2
 3
 4class AgentEnrollAuthSchema(OpenApiAuthenticationExtension):
 5
 6    target_class = "authentik.endpoints.connectors.agent.auth.AgentEnrollmentAuth"
 7    name = "authentik_device_enroll"
 8
 9    def get_security_definition(self, auto_schema):
10        """Auth schema"""
11        return {"type": "http", "scheme": "bearer"}
12
13
14class AgentAuthSchema(OpenApiAuthenticationExtension):
15
16    target_class = "authentik.endpoints.connectors.agent.auth.AgentAuth"
17    name = "authentik_device_auth"
18
19    def get_security_definition(self, auto_schema):
20        """Auth schema"""
21        return {"type": "http", "scheme": "bearer+agent"}
22
23
24class DeviceFederationAuthSchema(OpenApiAuthenticationExtension):
25
26    target_class = "authentik.endpoints.connectors.agent.auth.DeviceAuthFedAuthentication"
27    name = "authentik_device_federation"
28
29    def get_security_definition(self, auto_schema):
30        """Auth schema"""
31        return {"type": "http", "scheme": "bearer"}
class AgentEnrollAuthSchema(drf_spectacular.plumbing.OpenApiGeneratorExtension[ForwardRef('OpenApiAuthenticationExtension')]):
 5class AgentEnrollAuthSchema(OpenApiAuthenticationExtension):
 6
 7    target_class = "authentik.endpoints.connectors.agent.auth.AgentEnrollmentAuth"
 8    name = "authentik_device_enroll"
 9
10    def get_security_definition(self, auto_schema):
11        """Auth schema"""
12        return {"type": "http", "scheme": "bearer"}

Extension for specifying authentication schemes.

The common use-case usually consists of setting a name string and returning a dict from get_security_definition. To model a group of headers that go together, set a list of names and return a corresponding list of definitions from get_security_definition.

The view class is available via auto_schema.view, while the original authentication class can be accessed via self.target. If you want to override an included extension, be sure to set a higher matching priority by setting the class attribute priority = 1 or higher.

get_security_requirement is expected to return a dict with security object names as keys and a scope list as value (usually just []). More than one key in the dict means that each entry is required (AND). If you need alternate variations (OR), return a list of those dicts instead.

get_security_definition() is expected to return a valid OpenAPI security scheme object <https://spec.openapis.org/oas/v3.0.3#security-scheme-object>_

name = 'authentik_device_enroll'
def get_security_definition(self, auto_schema):
10    def get_security_definition(self, auto_schema):
11        """Auth schema"""
12        return {"type": "http", "scheme": "bearer"}

Auth schema

class AgentAuthSchema(drf_spectacular.plumbing.OpenApiGeneratorExtension[ForwardRef('OpenApiAuthenticationExtension')]):
15class AgentAuthSchema(OpenApiAuthenticationExtension):
16
17    target_class = "authentik.endpoints.connectors.agent.auth.AgentAuth"
18    name = "authentik_device_auth"
19
20    def get_security_definition(self, auto_schema):
21        """Auth schema"""
22        return {"type": "http", "scheme": "bearer+agent"}

Extension for specifying authentication schemes.

The common use-case usually consists of setting a name string and returning a dict from get_security_definition. To model a group of headers that go together, set a list of names and return a corresponding list of definitions from get_security_definition.

The view class is available via auto_schema.view, while the original authentication class can be accessed via self.target. If you want to override an included extension, be sure to set a higher matching priority by setting the class attribute priority = 1 or higher.

get_security_requirement is expected to return a dict with security object names as keys and a scope list as value (usually just []). More than one key in the dict means that each entry is required (AND). If you need alternate variations (OR), return a list of those dicts instead.

get_security_definition() is expected to return a valid OpenAPI security scheme object <https://spec.openapis.org/oas/v3.0.3#security-scheme-object>_

name = 'authentik_device_auth'
def get_security_definition(self, auto_schema):
20    def get_security_definition(self, auto_schema):
21        """Auth schema"""
22        return {"type": "http", "scheme": "bearer+agent"}

Auth schema

class DeviceFederationAuthSchema(drf_spectacular.plumbing.OpenApiGeneratorExtension[ForwardRef('OpenApiAuthenticationExtension')]):
25class DeviceFederationAuthSchema(OpenApiAuthenticationExtension):
26
27    target_class = "authentik.endpoints.connectors.agent.auth.DeviceAuthFedAuthentication"
28    name = "authentik_device_federation"
29
30    def get_security_definition(self, auto_schema):
31        """Auth schema"""
32        return {"type": "http", "scheme": "bearer"}

Extension for specifying authentication schemes.

The common use-case usually consists of setting a name string and returning a dict from get_security_definition. To model a group of headers that go together, set a list of names and return a corresponding list of definitions from get_security_definition.

The view class is available via auto_schema.view, while the original authentication class can be accessed via self.target. If you want to override an included extension, be sure to set a higher matching priority by setting the class attribute priority = 1 or higher.

get_security_requirement is expected to return a dict with security object names as keys and a scope list as value (usually just []). More than one key in the dict means that each entry is required (AND). If you need alternate variations (OR), return a list of those dicts instead.

get_security_definition() is expected to return a valid OpenAPI security scheme object <https://spec.openapis.org/oas/v3.0.3#security-scheme-object>_

name = 'authentik_device_federation'
def get_security_definition(self, auto_schema):
30    def get_security_definition(self, auto_schema):
31        """Auth schema"""
32        return {"type": "http", "scheme": "bearer"}

Auth schema