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 }
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
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
callback_view =
<class 'authentik.sources.oauth.types.oidc.OpenIDConnectOAuth2Callback'>
redirect_view =
<class 'OktaOAuthRedirect'>
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