authentik.enterprise.endpoints.connectors.google_chrome.models

Endpoint stage

 1"""Endpoint stage"""
 2
 3from typing import TYPE_CHECKING
 4
 5from django.db import models
 6from django.templatetags.static import static
 7from django.utils.translation import gettext_lazy as _
 8from google.oauth2.service_account import Credentials
 9from rest_framework.serializers import BaseSerializer
10
11from authentik.endpoints.models import Connector
12from authentik.flows.stage import StageView
13
14if TYPE_CHECKING:
15    from authentik.enterprise.endpoints.connectors.google_chrome.controller import (
16        GoogleChromeController,
17    )
18
19
20class GoogleChromeConnector(Connector):
21    """Verify Google Chrome Device Trust connection for the user's browser."""
22
23    credentials = models.JSONField()
24
25    def google_credentials(self):
26        return {
27            "credentials": Credentials.from_service_account_info(
28                self.credentials, scopes=["https://www.googleapis.com/auth/verifiedaccess"]
29            ),
30        }
31
32    @property
33    def icon_url(self):
34        return static("authentik/sources/google.svg")
35
36    @property
37    def serializer(self) -> type[BaseSerializer]:
38        from authentik.enterprise.endpoints.connectors.google_chrome.api import (
39            GoogleChromeConnectorSerializer,
40        )
41
42        return GoogleChromeConnectorSerializer
43
44    @property
45    def stage(self) -> type[StageView] | None:
46        from authentik.enterprise.endpoints.connectors.google_chrome.stage import (
47            GoogleChromeStageView,
48        )
49
50        return GoogleChromeStageView
51
52    @property
53    def controller(self) -> type[GoogleChromeController]:
54        from authentik.enterprise.endpoints.connectors.google_chrome.controller import (
55            GoogleChromeController,
56        )
57
58        return GoogleChromeController
59
60    @property
61    def component(self) -> str:
62        return "ak-endpoints-connector-gdtc-form"
63
64    def __str__(self) -> str:
65        return f"Google Device Trust Connector {self.name}"
66
67    class Meta:
68        verbose_name = _("Google Device Trust Connector")
69        verbose_name_plural = _("Google Device Trust Connectors")
class GoogleChromeConnector(authentik.endpoints.models.Connector):
21class GoogleChromeConnector(Connector):
22    """Verify Google Chrome Device Trust connection for the user's browser."""
23
24    credentials = models.JSONField()
25
26    def google_credentials(self):
27        return {
28            "credentials": Credentials.from_service_account_info(
29                self.credentials, scopes=["https://www.googleapis.com/auth/verifiedaccess"]
30            ),
31        }
32
33    @property
34    def icon_url(self):
35        return static("authentik/sources/google.svg")
36
37    @property
38    def serializer(self) -> type[BaseSerializer]:
39        from authentik.enterprise.endpoints.connectors.google_chrome.api import (
40            GoogleChromeConnectorSerializer,
41        )
42
43        return GoogleChromeConnectorSerializer
44
45    @property
46    def stage(self) -> type[StageView] | None:
47        from authentik.enterprise.endpoints.connectors.google_chrome.stage import (
48            GoogleChromeStageView,
49        )
50
51        return GoogleChromeStageView
52
53    @property
54    def controller(self) -> type[GoogleChromeController]:
55        from authentik.enterprise.endpoints.connectors.google_chrome.controller import (
56            GoogleChromeController,
57        )
58
59        return GoogleChromeController
60
61    @property
62    def component(self) -> str:
63        return "ak-endpoints-connector-gdtc-form"
64
65    def __str__(self) -> str:
66        return f"Google Device Trust Connector {self.name}"
67
68    class Meta:
69        verbose_name = _("Google Device Trust Connector")
70        verbose_name_plural = _("Google Device Trust Connectors")

Verify Google Chrome Device Trust connection for the user's browser.

def credentials(unknown):

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

def google_credentials(self):
26    def google_credentials(self):
27        return {
28            "credentials": Credentials.from_service_account_info(
29                self.credentials, scopes=["https://www.googleapis.com/auth/verifiedaccess"]
30            ),
31        }
icon_url
33    @property
34    def icon_url(self):
35        return static("authentik/sources/google.svg")
serializer: type[rest_framework.serializers.BaseSerializer]
37    @property
38    def serializer(self) -> type[BaseSerializer]:
39        from authentik.enterprise.endpoints.connectors.google_chrome.api import (
40            GoogleChromeConnectorSerializer,
41        )
42
43        return GoogleChromeConnectorSerializer

Get serializer for this model

stage: type[authentik.flows.stage.StageView] | None
45    @property
46    def stage(self) -> type[StageView] | None:
47        from authentik.enterprise.endpoints.connectors.google_chrome.stage import (
48            GoogleChromeStageView,
49        )
50
51        return GoogleChromeStageView
controller
53    @property
54    def controller(self) -> type[GoogleChromeController]:
55        from authentik.enterprise.endpoints.connectors.google_chrome.controller import (
56            GoogleChromeController,
57        )
58
59        return GoogleChromeController
component: str
61    @property
62    def component(self) -> str:
63        return "ak-endpoints-connector-gdtc-form"
schedules

Accessor to the related objects manager on the one-to-many relation created by GenericRelation.

In the example::

class Post(Model):
    comments = GenericRelation(Comment)

post.comments is a ReverseGenericManyToOneDescriptor instance.

tasks

Accessor to the related objects manager on the one-to-many relation created by GenericRelation.

In the example::

class Post(Model):
    comments = GenericRelation(Comment)

post.comments is a ReverseGenericManyToOneDescriptor instance.

connector_ptr_id
connector_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example::

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

class GoogleChromeConnector.DoesNotExist(authentik.endpoints.models.Connector.DoesNotExist):

The requested object does not exist

class GoogleChromeConnector.MultipleObjectsReturned(authentik.endpoints.models.Connector.MultipleObjectsReturned):

The query returned multiple objects when only one was expected.