From 1169c633cc4146a2ccd7dc0c023fb3d7103a1414 Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 10 Apr 2025 15:14:01 +0300 Subject: [PATCH] refactor: remove tailscale oauth --- .env.example | 3 - cmd/root.go | 31 +++---- .../src/components/auth/oauth-buttons.tsx | 14 --- frontend/src/icons/tailscale.tsx | 27 ------ internal/handlers/handlers.go | 27 ------ internal/providers/providers.go | 54 +----------- internal/providers/tailscale.go | 68 --------------- internal/types/api.go | 5 -- internal/types/config.go | 87 +++++++++---------- internal/utils/utils.go | 2 +- 10 files changed, 57 insertions(+), 261 deletions(-) delete mode 100644 frontend/src/icons/tailscale.tsx delete mode 100644 internal/providers/tailscale.go diff --git a/.env.example b/.env.example index ff48b2b..ef7f73f 100644 --- a/.env.example +++ b/.env.example @@ -12,9 +12,6 @@ GITHUB_CLIENT_SECRET_FILE=github_client_secret_file GOOGLE_CLIENT_ID=google_client_id GOOGLE_CLIENT_SECRET=google_client_secret GOOGLE_CLIENT_SECRET_FILE=google_client_secret_file -TAILSCALE_CLIENT_ID=tailscale_client_id -TAILSCALE_CLIENT_SECRET=tailscale_client_secret -TAILSCALE_CLIENT_SECRET_FILE=tailscale__client_secret_file GENERIC_CLIENT_ID=generic_client_id GENERIC_CLIENT_SECRET=generic_client_secret GENERIC_CLIENT_SECRET_FILE=generic_client_secret_file diff --git a/cmd/root.go b/cmd/root.go index 3cd4c1e..776c3cc 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -42,7 +42,6 @@ var rootCmd = &cobra.Command{ config.GithubClientSecret = utils.GetSecret(config.GithubClientSecret, config.GithubClientSecretFile) config.GoogleClientSecret = utils.GetSecret(config.GoogleClientSecret, config.GoogleClientSecretFile) config.GenericClientSecret = utils.GetSecret(config.GenericClientSecret, config.GenericClientSecretFile) - config.TailscaleClientSecret = utils.GetSecret(config.TailscaleClientSecret, config.TailscaleClientSecretFile) // Validate config validator := validator.New() @@ -77,19 +76,17 @@ var rootCmd = &cobra.Command{ // Create OAuth config oauthConfig := types.OAuthConfig{ - GithubClientId: config.GithubClientId, - GithubClientSecret: config.GithubClientSecret, - GoogleClientId: config.GoogleClientId, - GoogleClientSecret: config.GoogleClientSecret, - TailscaleClientId: config.TailscaleClientId, - TailscaleClientSecret: config.TailscaleClientSecret, - GenericClientId: config.GenericClientId, - GenericClientSecret: config.GenericClientSecret, - GenericScopes: strings.Split(config.GenericScopes, ","), - GenericAuthURL: config.GenericAuthURL, - GenericTokenURL: config.GenericTokenURL, - GenericUserURL: config.GenericUserURL, - AppURL: config.AppURL, + GithubClientId: config.GithubClientId, + GithubClientSecret: config.GithubClientSecret, + GoogleClientId: config.GoogleClientId, + GoogleClientSecret: config.GoogleClientSecret, + GenericClientId: config.GenericClientId, + GenericClientSecret: config.GenericClientSecret, + GenericScopes: strings.Split(config.GenericScopes, ","), + GenericAuthURL: config.GenericAuthURL, + GenericTokenURL: config.GenericTokenURL, + GenericUserURL: config.GenericUserURL, + AppURL: config.AppURL, } // Create handlers config @@ -189,9 +186,6 @@ func init() { rootCmd.Flags().String("google-client-id", "", "Google OAuth client ID.") rootCmd.Flags().String("google-client-secret", "", "Google OAuth client secret.") rootCmd.Flags().String("google-client-secret-file", "", "Google OAuth client secret file.") - rootCmd.Flags().String("tailscale-client-id", "", "Tailscale OAuth client ID.") - rootCmd.Flags().String("tailscale-client-secret", "", "Tailscale OAuth client secret.") - rootCmd.Flags().String("tailscale-client-secret-file", "", "Tailscale OAuth client secret file.") rootCmd.Flags().String("generic-client-id", "", "Generic OAuth client ID.") rootCmd.Flags().String("generic-client-secret", "", "Generic OAuth client secret.") rootCmd.Flags().String("generic-client-secret-file", "", "Generic OAuth client secret file.") @@ -223,9 +217,6 @@ func init() { viper.BindEnv("google-client-id", "GOOGLE_CLIENT_ID") viper.BindEnv("google-client-secret", "GOOGLE_CLIENT_SECRET") viper.BindEnv("google-client-secret-file", "GOOGLE_CLIENT_SECRET_FILE") - viper.BindEnv("tailscale-client-id", "TAILSCALE_CLIENT_ID") - viper.BindEnv("tailscale-client-secret", "TAILSCALE_CLIENT_SECRET") - viper.BindEnv("tailscale-client-secret-file", "TAILSCALE_CLIENT_SECRET_FILE") viper.BindEnv("generic-client-id", "GENERIC_CLIENT_ID") viper.BindEnv("generic-client-secret", "GENERIC_CLIENT_SECRET") viper.BindEnv("generic-client-secret-file", "GENERIC_CLIENT_SECRET_FILE") diff --git a/frontend/src/components/auth/oauth-buttons.tsx b/frontend/src/components/auth/oauth-buttons.tsx index eb8b239..ca295b3 100644 --- a/frontend/src/components/auth/oauth-buttons.tsx +++ b/frontend/src/components/auth/oauth-buttons.tsx @@ -2,7 +2,6 @@ import { Grid, Button } from "@mantine/core"; import { GithubIcon } from "../../icons/github"; import { GoogleIcon } from "../../icons/google"; import { OAuthIcon } from "../../icons/oauth"; -import { TailscaleIcon } from "../../icons/tailscale"; interface OAuthButtonsProps { oauthProviders: string[]; @@ -41,19 +40,6 @@ export const OAuthButtons = (props: OAuthButtonsProps) => { )} - {oauthProviders.includes("tailscale") && ( - - - - )} {oauthProviders.includes("generic") && (