feat: Add migrator for Google OAuth2 authenticator (#7018)

Signed-off-by: Fabricio Aguiar <fabricio.aguiar@gmail.com>
This commit is contained in:
Fabricio Aguiar
2025-07-18 14:49:39 +01:00
committed by thedoubl3j
parent e746589019
commit 8e58fee49c
4 changed files with 191 additions and 21 deletions

View File

@@ -9,6 +9,7 @@ from awx.sso.utils.oidc_migrator import OIDCMigrator
from awx.sso.utils.saml_migrator import SAMLMigrator
from awx.sso.utils.radius_migrator import RADIUSMigrator
from awx.sso.utils.tacacs_migrator import TACACSMigrator
from awx.sso.utils.google_oauth2_migrator import GoogleOAuth2Migrator
from awx.main.utils.gateway_client import GatewayClient, GatewayAPIError
@@ -22,6 +23,7 @@ class Command(BaseCommand):
parser.add_argument('--skip-saml', action='store_true', help='Skip importing SAML authenticator')
parser.add_argument('--skip-radius', action='store_true', help='Skip importing RADIUS authenticator')
parser.add_argument('--skip-tacacs', action='store_true', help='Skip importing TACACS+ authenticator')
parser.add_argument('--skip-google', action='store_true', help='Skip importing Google OAuth2 authenticator')
parser.add_argument('--force', action='store_true', help='Force migration even if configurations already exist')
def handle(self, *args, **options):
@@ -37,6 +39,7 @@ class Command(BaseCommand):
skip_saml = options['skip_saml']
skip_radius = options['skip_radius']
skip_tacacs = options['skip_tacacs']
skip_google = options['skip_google']
force = options['force']
# If the management command isn't called with all parameters needed to talk to Gateway, consider
@@ -83,6 +86,9 @@ class Command(BaseCommand):
if not skip_tacacs:
migrators.append(TACACSMigrator(gateway_client, self, force=force))
if not skip_google:
migrators.append(GoogleOAuth2Migrator(gateway_client, self, force=force))
# Run migrations
total_results = {
'created': 0,