authentik.sources.oauth.types.okta

Okta OAuth Views

 1"""Okta OAuth Views"""
 2
 3from typing import Any
 4
 5from authentik.sources.oauth.models import OAuthSource
 6from authentik.sources.oauth.types.oidc import OpenIDConnectOAuth2Callback
 7from authentik.sources.oauth.types.registry import SourceType, registry
 8from authentik.sources.oauth.views.redirect import OAuthRedirect
 9
10
11class OktaOAuthRedirect(OAuthRedirect):
12    """Okta OAuth2 Redirect"""
13
14    def get_additional_parameters(self, source: OAuthSource):  # pragma: no cover
15        return {
16            "scope": ["openid", "email", "profile"],
17        }
18
19
20@registry.register()
21class OktaType(SourceType):
22    """Okta Type definition"""
23
24    callback_view = OpenIDConnectOAuth2Callback
25    redirect_view = OktaOAuthRedirect
26    verbose_name = "Okta"
27    name = "okta"
28
29    urls_customizable = True
30
31    def get_base_user_properties(self, info: dict[str, Any], **kwargs) -> dict[str, Any]:
32        return {
33            "username": info.get("nickname"),
34            "email": info.get("email"),
35            "name": info.get("name"),
36            "groups": info.get("groups", []),
37        }
class OktaOAuthRedirect(authentik.sources.oauth.views.redirect.OAuthRedirect):
12class OktaOAuthRedirect(OAuthRedirect):
13    """Okta OAuth2 Redirect"""
14
15    def get_additional_parameters(self, source: OAuthSource):  # pragma: no cover
16        return {
17            "scope": ["openid", "email", "profile"],
18        }

Okta OAuth2 Redirect

def get_additional_parameters(self, source: authentik.sources.oauth.models.OAuthSource):
15    def get_additional_parameters(self, source: OAuthSource):  # pragma: no cover
16        return {
17            "scope": ["openid", "email", "profile"],
18        }

Return additional redirect parameters for this source.

@registry.register()
class OktaType(authentik.sources.oauth.types.registry.SourceType):
21@registry.register()
22class OktaType(SourceType):
23    """Okta Type definition"""
24
25    callback_view = OpenIDConnectOAuth2Callback
26    redirect_view = OktaOAuthRedirect
27    verbose_name = "Okta"
28    name = "okta"
29
30    urls_customizable = True
31
32    def get_base_user_properties(self, info: dict[str, Any], **kwargs) -> dict[str, Any]:
33        return {
34            "username": info.get("nickname"),
35            "email": info.get("email"),
36            "name": info.get("name"),
37            "groups": info.get("groups", []),
38        }

Okta Type definition

redirect_view = <class 'OktaOAuthRedirect'>
verbose_name = 'Okta'
name = 'okta'
urls_customizable = True
def get_base_user_properties(self, info: dict[str, typing.Any], **kwargs) -> dict[str, typing.Any]:
32    def get_base_user_properties(self, info: dict[str, Any], **kwargs) -> dict[str, Any]:
33        return {
34            "username": info.get("nickname"),
35            "email": info.get("email"),
36            "name": info.get("name"),
37            "groups": info.get("groups", []),
38        }

Get base user properties for enrollment/update