Clean up Google sign in (#258)

This is unnecessary; we are just using browser login

Updates tailscale/corp#18202

Signed-off-by: kari-ts <kari@tailscale.com>
pull/259/head
kari-ts 8 months ago committed by GitHub
parent af2e33d130
commit facf6406c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -59,8 +59,6 @@ class MainActivity : ComponentActivity() {
companion object {
// Request codes for Android callbacks.
// requestSignin is for Google Sign-In.
@JvmStatic val requestSignin: Int = 1000
// requestPrepareVPN is for when Android's VpnService.prepare completes.
@JvmStatic val requestPrepareVPN: Int = 1001

@ -11,27 +11,18 @@ public class Peer extends Fragment {
private static int resultOK = -1;
public class RequestCodes {
public static final int requestSignin = 1000;
public static final int requestPrepareVPN = 1001;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case RequestCodes.requestSignin:
if (resultCode != resultOK) {
// TODO: send null Google token
break;
}
// TODO: send Google token
case RequestCodes.requestPrepareVPN:
if (requestCode == RequestCodes.requestPrepareVPN) {
if (resultCode == resultOK) {
App.getApplication().startVPN();
} else {
App.getApplication().setWantRunning(false);
// notify VPN revoked
}
}
}
}

@ -1,43 +0,0 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
package com.tailscale.ipn;
import android.app.Activity;
import android.content.Intent;
import android.content.Context;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
// Google implements helpers for Google services.
public final class Google {
static String getIdTokenForActivity(Activity act) {
GoogleSignInAccount acc = GoogleSignIn.getLastSignedInAccount(act);
return acc.getIdToken();
}
static void googleSignIn(Activity act, String serverOAuthID, int reqCode) {
act.runOnUiThread(new Runnable() {
@Override
public void run() {
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(serverOAuthID)
.requestEmail()
.build();
GoogleSignInClient client = GoogleSignIn.getClient(act, gso);
Intent signInIntent = client.getSignInIntent();
App.startActivityForResult(act, signInIntent, reqCode);
}
});
}
static void googleSignOut(Context ctx) {
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.build();
GoogleSignInClient client = GoogleSignIn.getClient(ctx, gso);
client.signOut();
}
}
Loading…
Cancel
Save