diff --git a/knoe/core/actions.py b/knoe/core/actions.py index 0e5e4c1..ecd2a12 100644 --- a/knoe/core/actions.py +++ b/knoe/core/actions.py @@ -4749,8 +4749,9 @@ class KnoeConsoleInstaller(KnoeInstaller): if self._deployment_mode() != "k8s": return True - cmd_base, gcloud_env = inst_config._gcloud_plain(os.environ.copy()) - token_cmd = list(cmd_base) + ["auth", "print-access-token", "--quiet"] + gcloud_env = inst_config._augment_env_for_brew(os.environ.copy()) + cmd_base = ["gcloud"] + token_cmd = cmd_base + ["auth", "print-access-token", "--quiet"] try: token_res = subprocess.run( token_cmd, @@ -4766,7 +4767,7 @@ class KnoeConsoleInstaller(KnoeInstaller): interactive = bool(getattr(sys.stdin, "isatty", lambda: False)()) if interactive: - login_cmd = list(cmd_base) + ["auth", "login", "--no-launch-browser"] + login_cmd = cmd_base + ["auth", "login", "--no-launch-browser"] self.log( "[ACTION] No active gcloud session found. Starting login flow: " + " ".join(shlex.quote(part) for part in login_cmd) diff --git a/knoe/core/milestones.py b/knoe/core/milestones.py index ca3ede7..c2523da 100644 --- a/knoe/core/milestones.py +++ b/knoe/core/milestones.py @@ -130,8 +130,9 @@ class DependenciesMilestone(Milestone): if cluster_env not in {"prod", "production", "k8s"}: return True - cmd_base, gcloud_env = inst_config._gcloud_plain(os.environ.copy()) - token_cmd = list(cmd_base) + ["auth", "print-access-token", "--quiet"] + gcloud_env = inst_config._augment_env_for_brew(os.environ.copy()) + cmd_base = ["gcloud"] + token_cmd = cmd_base + ["auth", "print-access-token", "--quiet"] try: token_res = subprocess.run( token_cmd, @@ -147,7 +148,7 @@ class DependenciesMilestone(Milestone): interactive = bool(getattr(sys.stdin, "isatty", lambda: False)()) if interactive: - login_cmd = list(cmd_base) + ["auth", "login", "--no-launch-browser"] + login_cmd = cmd_base + ["auth", "login", "--no-launch-browser"] self.logger.info( "[ACTION] No active gcloud session found. Starting login flow: %s", " ".join(shlex.quote(part) for part in login_cmd), diff --git a/prole-auth/src/main/java/org/prole/auth/kerberos/KerberosPasswordService.java b/prole-auth/src/main/java/org/prole/auth/kerberos/KerberosPasswordService.java index 95d2636..8bba94f 100644 --- a/prole-auth/src/main/java/org/prole/auth/kerberos/KerberosPasswordService.java +++ b/prole-auth/src/main/java/org/prole/auth/kerberos/KerberosPasswordService.java @@ -42,26 +42,19 @@ public class KerberosPasswordService { } } - private static final class FixedCallbackHandler implements CallbackHandler { - private final String principal; - private final char[] password; + private record FixedCallbackHandler(String principal, char[] password) implements CallbackHandler { - private FixedCallbackHandler(String principal, char[] password) { - this.principal = principal; - this.password = password; - } - - @Override - public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { - for (Callback cb : callbacks) { - if (cb instanceof NameCallback name) { - name.setName(principal); - } else if (cb instanceof PasswordCallback pw) { - pw.setPassword(password); - } else { - throw new UnsupportedCallbackException(cb); + @Override + public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { + for (Callback cb : callbacks) { + if (cb instanceof NameCallback name) { + name.setName(principal); + } else if (cb instanceof PasswordCallback pw) { + pw.setPassword(password); + } else { + throw new UnsupportedCallbackException(cb); + } + } } - } } - } } diff --git a/prole-auth/src/main/java/org/prole/auth/web/LoginController.java b/prole-auth/src/main/java/org/prole/auth/web/LoginController.java index ff329b9..98a1e78 100644 --- a/prole-auth/src/main/java/org/prole/auth/web/LoginController.java +++ b/prole-auth/src/main/java/org/prole/auth/web/LoginController.java @@ -69,10 +69,10 @@ public class LoginController { String safeNext = safeNext(next).toString(); String html = """ - + - - + + Prole Login