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 rest_framework.serializers import BaseSerializer 9 10from authentik.endpoints.controller import ConnectorSyncException 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 from google.auth.exceptions import GoogleAuthError 27 from google.oauth2.service_account import Credentials 28 29 try: 30 return { 31 "credentials": Credentials.from_service_account_info( 32 self.credentials, scopes=["https://www.googleapis.com/auth/verifiedaccess"] 33 ), 34 } 35 except GoogleAuthError as exc: 36 raise ConnectorSyncException from exc 37 38 @property 39 def icon_url(self): 40 return static("authentik/sources/google/light.svg") 41 42 @property 43 def serializer(self) -> type[BaseSerializer]: 44 from authentik.enterprise.endpoints.connectors.google_chrome.api import ( 45 GoogleChromeConnectorSerializer, 46 ) 47 48 return GoogleChromeConnectorSerializer 49 50 @property 51 def stage(self) -> type[StageView] | None: 52 from authentik.enterprise.endpoints.connectors.google_chrome.stage import ( 53 GoogleChromeStageView, 54 ) 55 56 return GoogleChromeStageView 57 58 @property 59 def controller(self) -> type[GoogleChromeController]: 60 from authentik.enterprise.endpoints.connectors.google_chrome.controller import ( 61 GoogleChromeController, 62 ) 63 64 return GoogleChromeController 65 66 @property 67 def component(self) -> str: 68 return "ak-endpoints-connector-gdtc-form" 69 70 def __str__(self) -> str: 71 return f"Google Device Trust Connector {self.name}" 72 73 class Meta: 74 verbose_name = _("Google Device Trust Connector") 75 verbose_name_plural = _("Google Device Trust Connectors")
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 from google.auth.exceptions import GoogleAuthError 28 from google.oauth2.service_account import Credentials 29 30 try: 31 return { 32 "credentials": Credentials.from_service_account_info( 33 self.credentials, scopes=["https://www.googleapis.com/auth/verifiedaccess"] 34 ), 35 } 36 except GoogleAuthError as exc: 37 raise ConnectorSyncException from exc 38 39 @property 40 def icon_url(self): 41 return static("authentik/sources/google/light.svg") 42 43 @property 44 def serializer(self) -> type[BaseSerializer]: 45 from authentik.enterprise.endpoints.connectors.google_chrome.api import ( 46 GoogleChromeConnectorSerializer, 47 ) 48 49 return GoogleChromeConnectorSerializer 50 51 @property 52 def stage(self) -> type[StageView] | None: 53 from authentik.enterprise.endpoints.connectors.google_chrome.stage import ( 54 GoogleChromeStageView, 55 ) 56 57 return GoogleChromeStageView 58 59 @property 60 def controller(self) -> type[GoogleChromeController]: 61 from authentik.enterprise.endpoints.connectors.google_chrome.controller import ( 62 GoogleChromeController, 63 ) 64 65 return GoogleChromeController 66 67 @property 68 def component(self) -> str: 69 return "ak-endpoints-connector-gdtc-form" 70 71 def __str__(self) -> str: 72 return f"Google Device Trust Connector {self.name}" 73 74 class Meta: 75 verbose_name = _("Google Device Trust Connector") 76 verbose_name_plural = _("Google Device Trust Connectors")
Verify Google Chrome Device Trust connection for the user's browser.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
26 def google_credentials(self): 27 from google.auth.exceptions import GoogleAuthError 28 from google.oauth2.service_account import Credentials 29 30 try: 31 return { 32 "credentials": Credentials.from_service_account_info( 33 self.credentials, scopes=["https://www.googleapis.com/auth/verifiedaccess"] 34 ), 35 } 36 except GoogleAuthError as exc: 37 raise ConnectorSyncException from exc
43 @property 44 def serializer(self) -> type[BaseSerializer]: 45 from authentik.enterprise.endpoints.connectors.google_chrome.api import ( 46 GoogleChromeConnectorSerializer, 47 ) 48 49 return GoogleChromeConnectorSerializer
Get serializer for this model
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.
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.
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.
Inherited Members
The requested object does not exist
The query returned multiple objects when only one was expected.