Repo Created
This commit is contained in:
parent
eb305e2886
commit
a8c22c65db
4784 changed files with 329907 additions and 2 deletions
48
play-services-auth/build.gradle
Normal file
48
play-services-auth/build.gradle
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'signing'
|
||||
|
||||
android {
|
||||
namespace "com.google.android.gms.auth.api"
|
||||
|
||||
compileSdkVersion androidCompileSdk
|
||||
buildToolsVersion "$androidBuildVersionTools"
|
||||
|
||||
buildFeatures {
|
||||
aidl = true
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
versionName version
|
||||
minSdkVersion androidMinSdk
|
||||
targetSdkVersion androidTargetSdk
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
}
|
||||
}
|
||||
|
||||
apply from: '../gradle/publish-android.gradle'
|
||||
|
||||
description = 'microG implementation of play-services-auth'
|
||||
|
||||
dependencies {
|
||||
// Dependencies from play-services-auth:21.4.0
|
||||
api "androidx.fragment:fragment:1.5.7"
|
||||
api "androidx.loader:loader:1.1.0"
|
||||
api project(':play-services-auth-api-phone')
|
||||
api project(':play-services-auth-base')
|
||||
api project(':play-services-base')
|
||||
api project(':play-services-basement')
|
||||
api project(':play-services-fido')
|
||||
api project(':play-services-tasks')
|
||||
|
||||
annotationProcessor project(':safe-parcel-processor')
|
||||
}
|
||||
6
play-services-auth/src/main/AndroidManifest.xml
Normal file
6
play-services-auth/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ SPDX-FileCopyrightText: 2022 microG Project Team
|
||||
~ SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<manifest />
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.account.data;
|
||||
|
||||
import com.google.android.gms.auth.account.data.IDeviceManagementInfoCallback;
|
||||
import android.accounts.Account;
|
||||
import com.google.android.gms.common.api.internal.IStatusCallback;
|
||||
|
||||
interface IAccountDataService {
|
||||
void requestDeviceManagementInfo(in IDeviceManagementInfoCallback callback, in Account account) = 0;
|
||||
void requestAccountInfo(in IStatusCallback callback, in Account account, boolean isPrimary) = 1;
|
||||
void requestProfileInfo(in IStatusCallback callback, String profile) = 2;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.account.data;
|
||||
|
||||
import com.google.android.gms.auth.firstparty.dataservice.DeviceManagementInfoResponse;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
|
||||
interface IDeviceManagementInfoCallback {
|
||||
void onResult(in Status status, in DeviceManagementInfoResponse response);
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.auth.api.credentials;
|
||||
|
||||
parcelable Credential;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.auth.api.credentials;
|
||||
|
||||
parcelable CredentialRequest;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.auth.api.credentials.internal;
|
||||
|
||||
parcelable DeleteRequest;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.auth.api.credentials.internal;
|
||||
|
||||
parcelable GeneratePasswordRequest;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.google.android.gms.auth.api.credentials.internal;
|
||||
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.auth.api.credentials.Credential;
|
||||
|
||||
interface ICredentialsCallbacks {
|
||||
void onStatusAndCredential(in Status status, in Credential credential) = 0;
|
||||
void onStatus(in Status status) = 1;
|
||||
void onStatusAndString(in Status status, String string) = 2;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.google.android.gms.auth.api.credentials.internal;
|
||||
|
||||
import com.google.android.gms.auth.api.credentials.CredentialRequest;
|
||||
import com.google.android.gms.auth.api.credentials.internal.ICredentialsCallbacks;
|
||||
import com.google.android.gms.auth.api.credentials.internal.DeleteRequest;
|
||||
import com.google.android.gms.auth.api.credentials.internal.GeneratePasswordRequest;
|
||||
import com.google.android.gms.auth.api.credentials.internal.SaveRequest;
|
||||
|
||||
interface ICredentialsService {
|
||||
void request(ICredentialsCallbacks callbacks, in CredentialRequest request) = 0;
|
||||
void save(ICredentialsCallbacks callbacks, in SaveRequest request) = 1;
|
||||
void delete(ICredentialsCallbacks callbacks, in DeleteRequest request) = 2;
|
||||
void disableAutoSignIn(ICredentialsCallbacks callbacks) = 3;
|
||||
void generatePassword(ICredentialsCallbacks callbacks, in GeneratePasswordRequest request) = 4;
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.auth.api.credentials.internal;
|
||||
|
||||
parcelable SaveRequest;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
parcelable AuthorizationRequest;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
parcelable AuthorizationResult;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
parcelable BeginSignInRequest;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
parcelable BeginSignInResult;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
parcelable GetPhoneNumberHintIntentRequest;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
parcelable GetSignInIntentRequest;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
parcelable SignInCredential;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
parcelable VerifyWithGoogleRequest;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
parcelable VerifyWithGoogleResult;
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity.internal;
|
||||
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.auth.api.identity.AuthorizationResult;
|
||||
|
||||
interface IAuthorizationCallback {
|
||||
void onAuthorized(in Status status, in AuthorizationResult result);
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity.internal;
|
||||
|
||||
import com.google.android.gms.auth.api.identity.internal.IAuthorizationCallback;
|
||||
import com.google.android.gms.auth.api.identity.internal.IVerifyWithGoogleCallback;
|
||||
import com.google.android.gms.auth.api.identity.AuthorizationRequest;
|
||||
import com.google.android.gms.auth.api.identity.VerifyWithGoogleRequest;
|
||||
|
||||
interface IAuthorizationService {
|
||||
void authorize(in IAuthorizationCallback callback, in AuthorizationRequest request) = 0;
|
||||
void verifyWithGoogle(in IVerifyWithGoogleCallback callback, in VerifyWithGoogleRequest request) = 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity.internal;
|
||||
|
||||
import com.google.android.gms.auth.api.identity.BeginSignInResult;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
|
||||
interface IBeginSignInCallback {
|
||||
void onResult(in Status status, in BeginSignInResult beginSignInResult);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity.internal;
|
||||
|
||||
import com.google.android.gms.common.api.Status;
|
||||
|
||||
interface IGetPhoneNumberHintIntentCallback {
|
||||
void onResult(in Status status, in PendingIntent pendingIntent);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity.internal;
|
||||
|
||||
import com.google.android.gms.common.api.Status;
|
||||
|
||||
interface IGetSignInIntentCallback {
|
||||
void onResult(in Status status, in PendingIntent pendingIntent);
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity.internal;
|
||||
|
||||
import com.google.android.gms.common.api.internal.IStatusCallback;
|
||||
import com.google.android.gms.auth.api.identity.internal.IBeginSignInCallback;
|
||||
import com.google.android.gms.auth.api.identity.internal.IGetSignInIntentCallback;
|
||||
import com.google.android.gms.auth.api.identity.internal.IGetPhoneNumberHintIntentCallback;
|
||||
import com.google.android.gms.auth.api.identity.BeginSignInRequest;
|
||||
import com.google.android.gms.auth.api.identity.GetSignInIntentRequest;
|
||||
import com.google.android.gms.auth.api.identity.GetPhoneNumberHintIntentRequest;
|
||||
|
||||
interface ISignInService {
|
||||
void beginSignIn(in IBeginSignInCallback callback, in BeginSignInRequest request) = 0;
|
||||
void signOut(in IStatusCallback callback, String userId) = 1;
|
||||
void getSignInIntent(in IGetSignInIntentCallback callback, in GetSignInIntentRequest request) = 2;
|
||||
void getPhoneNumberHintIntent(in IGetPhoneNumberHintIntentCallback callback, in GetPhoneNumberHintIntentRequest request) = 3;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity.internal;
|
||||
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.auth.api.identity.VerifyWithGoogleResult;
|
||||
|
||||
interface IVerifyWithGoogleCallback {
|
||||
void onVerifed(in Status status, in VerifyWithGoogleResult result);
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.google.android.gms.auth.api.signin.internal;
|
||||
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
|
||||
interface ISignInCallbacks {
|
||||
void onSignIn(in GoogleSignInAccount account, in Status status) = 100;
|
||||
void onSignOut(in Status status) = 101;
|
||||
void onRevokeAccess(in Status status) = 102;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.google.android.gms.auth.api.signin.internal;
|
||||
|
||||
import com.google.android.gms.auth.api.signin.internal.ISignInCallbacks;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
|
||||
|
||||
interface ISignInService {
|
||||
void silentSignIn(ISignInCallbacks callbacks, in GoogleSignInOptions options) = 100;
|
||||
void signOut(ISignInCallbacks callbacks, in GoogleSignInOptions options) = 101;
|
||||
void revokeAccess(ISignInCallbacks callbacks, in GoogleSignInOptions options) = 102;
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api;
|
||||
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInApi;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
|
||||
import com.google.android.gms.common.api.Api;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
import org.microg.gms.auth.api.signin.GoogleSignInApiImpl;
|
||||
import org.microg.gms.auth.api.signin.GoogleSignInGmsClientImpl;
|
||||
|
||||
/**
|
||||
* Entry point for Google Auth APIs through GoogleApiClient.
|
||||
*/
|
||||
public class Auth {
|
||||
/**
|
||||
* Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the Google Sign In API.
|
||||
*/
|
||||
public static final Api<GoogleSignInOptions> GOOGLE_SIGN_IN_API = new Api<>((options, context, looper, clientSettings, callbacks, connectionFailedListener) -> new GoogleSignInGmsClientImpl(context, callbacks, connectionFailedListener));
|
||||
|
||||
/**
|
||||
* Api entry point for Google Sign In.
|
||||
*/
|
||||
public static final GoogleSignInApi GoogleSignInApi = new GoogleSignInApiImpl();
|
||||
}
|
||||
|
|
@ -0,0 +1,235 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2016, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.credentials;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.microg.gms.common.PublicApi;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
import org.microg.safeparcel.SafeParceled;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@PublicApi
|
||||
public class Credential extends AutoSafeParcelable {
|
||||
|
||||
@Field(1000)
|
||||
private int versionCode = 1;
|
||||
|
||||
@Field(1)
|
||||
private String id;
|
||||
@Field(2)
|
||||
private String name;
|
||||
@Field(3)
|
||||
private Uri profilePictureUri;
|
||||
@Field(value = 4, subClass = IdToken.class)
|
||||
private List<IdToken> tokens;
|
||||
@Field(5)
|
||||
private String password;
|
||||
@Field(6)
|
||||
private String accountType;
|
||||
@Field(7)
|
||||
private String generatedPassword;
|
||||
|
||||
private Credential() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of federated identity account used to sign in the user. While this may be
|
||||
* any string, it is strongly recommended that values from {@link com.google.android.gms.auth.api.credentials.IdentityProviders}
|
||||
* are used, which are the login domains for common identity providers.
|
||||
*
|
||||
* @return A string identifying the federated identity provider associated with this account,
|
||||
* typically in the form of the identity provider's login domain. null will be returned if the
|
||||
* credential is a password credential.
|
||||
*/
|
||||
public String getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the generated password for an account hint.
|
||||
*/
|
||||
public String getGeneratedPassword() {
|
||||
return generatedPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the credential identifier, typically an email address or user name, though it may
|
||||
* also be some encoded unique identifier for a federated identity account.
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID tokens that assert the identity of the user, if available. ID tokens provide
|
||||
* a secure mechanism to verify that the user owns the identity asserted by the credential.
|
||||
* <p/>
|
||||
* This is useful for account hints, where the ID token can replace the need to separately
|
||||
* verify that the user owns their claimed email address - with a valid ID token, it is not
|
||||
* necessary to send an account activation link to the address, simplifying the account
|
||||
* creation process for the user.
|
||||
* <p/>
|
||||
* A signed ID token is returned automatically for credential hints when the credential ID is a
|
||||
* Google account that is authenticated on the device. This ID token can be sent along with
|
||||
* your application's account creation operation, where the signature can be verified.
|
||||
*/
|
||||
public List<IdToken> getIdTokens() {
|
||||
return tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the display name of the credential, if available. Typically, the display name will
|
||||
* be the name of the user, or some other string which the user can easily recognize and
|
||||
* distinguish from other accounts they may have.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the password used to sign in the user.
|
||||
*/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL to an image of the user, if available.
|
||||
*/
|
||||
public Uri getProfilePictureUri() {
|
||||
return profilePictureUri;
|
||||
}
|
||||
|
||||
@PublicApi(exclude = true)
|
||||
public String getAsString() {
|
||||
if (TextUtils.isEmpty(accountType)) {
|
||||
return id.toLowerCase(Locale.US) + "|";
|
||||
} else {
|
||||
Uri uri = Uri.parse(accountType);
|
||||
return id.toLowerCase(Locale.US) + "|" + (TextUtils.isEmpty(uri.getScheme()) ? "" : uri.getScheme().toLowerCase(Locale.US)) + "://" +
|
||||
(TextUtils.isEmpty(uri.getHost()) ? "unknown" : uri.getHost().toLowerCase(Locale.US)) + ":" + uri.getPort();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || !(o instanceof Credential)) return false;
|
||||
|
||||
Credential that = (Credential) o;
|
||||
|
||||
if (id != null ? !id.equals(that.id) : that.id != null) return false;
|
||||
if (name != null ? !name.equals(that.name) : that.name != null) return false;
|
||||
if (profilePictureUri != null ? !profilePictureUri.equals(that.profilePictureUri) : that.profilePictureUri != null)
|
||||
return false;
|
||||
if (password != null ? !password.equals(that.password) : that.password != null)
|
||||
return false;
|
||||
if (accountType != null ? !accountType.equals(that.accountType) : that.accountType != null)
|
||||
return false;
|
||||
return generatedPassword != null ? generatedPassword.equals(that.generatedPassword) : that.generatedPassword == null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(new Object[]{id, name, profilePictureUri, password, accountType, generatedPassword});
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String id;
|
||||
private String name;
|
||||
private Uri profilePictureUri;
|
||||
private String password;
|
||||
private String accountType;
|
||||
|
||||
@PublicApi(exclude = true)
|
||||
public List<IdToken> tokens;
|
||||
@PublicApi(exclude = true)
|
||||
private String generatedPassword;
|
||||
|
||||
public Builder(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the information stored in an existing credential, in order to allow that information to be modified.
|
||||
*
|
||||
* @param credential the existing credential
|
||||
*/
|
||||
public Builder(Credential credential) {
|
||||
this.id = credential.id;
|
||||
this.name = credential.name;
|
||||
this.profilePictureUri = credential.profilePictureUri;
|
||||
this.password = credential.password;
|
||||
this.accountType = credential.accountType;
|
||||
this.tokens = credential.tokens;
|
||||
this.generatedPassword = credential.generatedPassword;
|
||||
}
|
||||
|
||||
public Credential build() {
|
||||
Credential credential = new Credential();
|
||||
credential.id = id;
|
||||
credential.name = name;
|
||||
credential.profilePictureUri = profilePictureUri;
|
||||
credential.password = password;
|
||||
credential.accountType = accountType;
|
||||
credential.tokens = tokens;
|
||||
credential.generatedPassword = generatedPassword;
|
||||
return credential;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the account type for a federated credential. The value should be set to
|
||||
* identity provider's login domain, such as "https://accounts.google.com" for Google
|
||||
* accounts. The login domains for common identity providers are listed in {@link IdentityProviders}.
|
||||
*
|
||||
* @param accountType The type of the account. Typically, one of the values in {@link IdentityProviders}.
|
||||
*/
|
||||
public Builder setAccountType(String accountType) {
|
||||
this.accountType = accountType;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the display name for the credential, which should be easy for the user to recognize
|
||||
* as associated to the credential, and distinguishable from other credentials they may
|
||||
* have. This string will be displayed more prominently than, or instead of, the account ID
|
||||
* whenever available. In most cases, the name of the user is sufficient.
|
||||
*/
|
||||
public Builder setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the password for the credential. Either the password or the account type must be
|
||||
* set for a credential, but not both.
|
||||
*/
|
||||
public Builder setPassword(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a profile picture associated with the credential, typically a picture the user has
|
||||
* selected to represent the account.
|
||||
*/
|
||||
public Builder setProfilePictureUri(Uri profilePictureUri) {
|
||||
this.profilePictureUri = profilePictureUri;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public static final Creator<Credential> CREATOR = new AutoCreator<Credential>(Credential.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2016, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.credentials;
|
||||
|
||||
import org.microg.gms.common.PublicApi;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
import org.microg.safeparcel.SafeParceled;
|
||||
|
||||
@PublicApi
|
||||
public class CredentialPickerConfig extends AutoSafeParcelable {
|
||||
|
||||
@Field(1000)
|
||||
private int versionCode = 1;
|
||||
|
||||
@Field(1)
|
||||
private boolean showAddAccountButton;
|
||||
@Field(2)
|
||||
private boolean showCancelButton;
|
||||
@Field(3)
|
||||
private boolean forNewAccount;
|
||||
|
||||
private CredentialPickerConfig() {
|
||||
}
|
||||
|
||||
public CredentialPickerConfig(boolean showAddAccountButton, boolean showCancelButton, boolean forNewAccount) {
|
||||
this.showAddAccountButton = showAddAccountButton;
|
||||
this.showCancelButton = showCancelButton;
|
||||
this.forNewAccount = forNewAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated It was determined that this method was not useful for developers.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isForNewAccount() {
|
||||
return forNewAccount;
|
||||
}
|
||||
|
||||
public boolean shouldShowAddAccountButton() {
|
||||
return showAddAccountButton;
|
||||
}
|
||||
|
||||
public boolean shouldShowCancelButton() {
|
||||
return showCancelButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CredentialPickerConfig{" +
|
||||
"showAddAccountButton=" + showAddAccountButton +
|
||||
", showCancelButton=" + showCancelButton +
|
||||
'}';
|
||||
}
|
||||
|
||||
public class Builder {
|
||||
private boolean showAddAccountButton;
|
||||
private boolean showCancelButton;
|
||||
private boolean forNewAccount;
|
||||
|
||||
public CredentialPickerConfig build() {
|
||||
return new CredentialPickerConfig(showAddAccountButton, showCancelButton, forNewAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the hint request is for a new account sign-up flow.
|
||||
*/
|
||||
public Builder setForNewAccount(boolean forNewAccount) {
|
||||
this.forNewAccount = forNewAccount;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the add account button should be shown in credential picker dialog.
|
||||
*/
|
||||
public Builder setShowAddAccountButton(boolean showAddAccountButton) {
|
||||
this.showAddAccountButton = showAddAccountButton;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the cancel button should be shown in credential picker dialog.
|
||||
*/
|
||||
public Builder setShowCancelButton(boolean showCancelButton) {
|
||||
this.showCancelButton = showCancelButton;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public static final Creator<CredentialPickerConfig> CREATOR = new AutoCreator<CredentialPickerConfig>(CredentialPickerConfig.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2016, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.credentials;
|
||||
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
import org.microg.safeparcel.SafeParceled;
|
||||
|
||||
/**
|
||||
* Parameters for requesting a Credential, via Auth.CredentialsApi.request(). Instances can be
|
||||
* created using CredentialRequest.Builder.
|
||||
*/
|
||||
public class CredentialRequest extends AutoSafeParcelable {
|
||||
|
||||
@Field(1000)
|
||||
private int versionCode = 1;
|
||||
|
||||
@Field(1)
|
||||
private boolean passwordLoginSupported;
|
||||
@Field(2)
|
||||
private String[] accountTypes;
|
||||
@Field(3)
|
||||
private CredentialPickerConfig credentialPickerConfig;
|
||||
@Field(4)
|
||||
private CredentialPickerConfig credentialHintPickerConfig;
|
||||
|
||||
private CredentialRequest() { }
|
||||
|
||||
public CredentialRequest(boolean passwordLoginSupported, String[] accountTypes, CredentialPickerConfig credentialPickerConfig, CredentialPickerConfig credentialHintPickerConfig) {
|
||||
this.passwordLoginSupported = passwordLoginSupported;
|
||||
this.accountTypes = accountTypes;
|
||||
this.credentialPickerConfig = credentialPickerConfig;
|
||||
this.credentialHintPickerConfig = credentialHintPickerConfig;
|
||||
}
|
||||
|
||||
public String[] getAccountTypes() {
|
||||
return accountTypes;
|
||||
}
|
||||
|
||||
public CredentialPickerConfig getCredentialHintPickerConfig() {
|
||||
return credentialHintPickerConfig;
|
||||
}
|
||||
|
||||
public CredentialPickerConfig getCredentialPickerConfig() {
|
||||
return credentialPickerConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #isPasswordLoginSupported()}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getSupportsPasswordLogin() {
|
||||
return isPasswordLoginSupported();
|
||||
}
|
||||
|
||||
public boolean isPasswordLoginSupported() {
|
||||
return passwordLoginSupported;
|
||||
}
|
||||
|
||||
public static final Creator<CredentialRequest> CREATOR = new AutoCreator<CredentialRequest>(CredentialRequest.class);
|
||||
|
||||
public static class Builder {
|
||||
private boolean passwordLoginSupported;
|
||||
private String[] accountTypes;
|
||||
private CredentialPickerConfig credentialPickerConfig;
|
||||
private CredentialPickerConfig credentialHintPickerConfig;
|
||||
|
||||
public void setAccountTypes(String... accountTypes) {
|
||||
this.accountTypes = accountTypes.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.credentials;
|
||||
|
||||
import org.microg.gms.common.PublicApi;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Parameters for requesting the display of the hint picker, via {@link CredentalsApi#getHintPickerIntent()}.
|
||||
* Instances can be created using {@link HintRequest.Builder}.
|
||||
*/
|
||||
@PublicApi
|
||||
public class HintRequest extends AutoSafeParcelable {
|
||||
@Field(1000)
|
||||
private int versionCode = 2;
|
||||
|
||||
@Field(1)
|
||||
private CredentialPickerConfig hintPickerConfig;
|
||||
@Field(2)
|
||||
private boolean emailAddressIdentifierSupported;
|
||||
@Field(3)
|
||||
private boolean phoneNumberIdentifierSupported;
|
||||
@Field(4)
|
||||
private String[] accountTypes;
|
||||
@Field(5)
|
||||
private boolean idTokenRequested = true;
|
||||
@Field(6)
|
||||
private String serverClientId;
|
||||
@Field(7)
|
||||
private String idTokenNonce;
|
||||
|
||||
private HintRequest() {
|
||||
}
|
||||
|
||||
public HintRequest(CredentialPickerConfig hintPickerConfig, boolean emailAddressIdentifierSupported, boolean phoneNumberIdentifierSupported, String[] accountTypes, boolean idTokenRequested, String serverClientId, String idTokenNonce) {
|
||||
this.hintPickerConfig = hintPickerConfig;
|
||||
this.emailAddressIdentifierSupported = emailAddressIdentifierSupported;
|
||||
this.phoneNumberIdentifierSupported = phoneNumberIdentifierSupported;
|
||||
this.accountTypes = accountTypes;
|
||||
this.idTokenRequested = idTokenRequested;
|
||||
this.serverClientId = serverClientId;
|
||||
this.idTokenNonce = idTokenNonce;
|
||||
}
|
||||
|
||||
public String[] getAccountTypes() {
|
||||
return accountTypes;
|
||||
}
|
||||
|
||||
public CredentialPickerConfig getHintPickerConfig() {
|
||||
return hintPickerConfig;
|
||||
}
|
||||
|
||||
public String getIdTokenNonce() {
|
||||
return idTokenNonce;
|
||||
}
|
||||
|
||||
public String getServerClientId() {
|
||||
return serverClientId;
|
||||
}
|
||||
|
||||
public boolean isEmailAddressIdentifierSupported() {
|
||||
return emailAddressIdentifierSupported;
|
||||
}
|
||||
|
||||
public boolean isPhoneNumberIdentifierSupported() {
|
||||
return phoneNumberIdentifierSupported;
|
||||
}
|
||||
|
||||
public boolean isIdTokenRequested() {
|
||||
return idTokenRequested;
|
||||
}
|
||||
|
||||
public static final Creator<HintRequest> CREATOR = new AutoCreator<>(HintRequest.class);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HintRequest{" +
|
||||
"hintPickerConfig=" + hintPickerConfig +
|
||||
", emailAddressIdentifierSupported=" + emailAddressIdentifierSupported +
|
||||
", phoneNumberIdentifierSupported=" + phoneNumberIdentifierSupported +
|
||||
", accountTypes=" + Arrays.toString(accountTypes) +
|
||||
", idTokenRequested=" + idTokenRequested +
|
||||
", serverClientId='" + serverClientId + '\'' +
|
||||
", idTokenNonce='" + idTokenNonce + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private CredentialPickerConfig hintPickerConfig;
|
||||
private boolean emailAddressIdentifierSupported;
|
||||
private boolean phoneNumberIdentifierSupported;
|
||||
private String[] accountTypes;
|
||||
private boolean idTokenRequested = true;
|
||||
private String serverClientId;
|
||||
private String idTokenNonce;
|
||||
|
||||
/**
|
||||
* Builds a {@link HintRequest}.
|
||||
*/
|
||||
public HintRequest build() {
|
||||
return new HintRequest(hintPickerConfig, emailAddressIdentifierSupported, phoneNumberIdentifierSupported, accountTypes, idTokenRequested, serverClientId, idTokenNonce);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the account types (identity providers) that are accepted by this application.
|
||||
* It is strongly recommended that the strings listed in {@link IdentityProviders} be used for the most common
|
||||
* identity providers, and strings representing the login domain of the identity provider be used for any
|
||||
* others which are not listed.
|
||||
*
|
||||
* @param accountTypes The list of account types (identity providers) supported by the app.
|
||||
* typically in the form of the associated login domain for each identity provider.
|
||||
*/
|
||||
public void setAccountTypes(String... accountTypes) {
|
||||
this.accountTypes = accountTypes.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables returning {@link Credential} hints where the identifier is an email address, intended for use with a password chosen by the user.
|
||||
*/
|
||||
public void setEmailAddressIdentifierSupported(boolean emailAddressIdentifierSupported) {
|
||||
this.emailAddressIdentifierSupported = emailAddressIdentifierSupported;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the configuration for the hint picker dialog.
|
||||
*/
|
||||
public void setHintPickerConfig(CredentialPickerConfig hintPickerConfig) {
|
||||
this.hintPickerConfig = hintPickerConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a nonce value that should be included in any generated ID token for this request.
|
||||
*/
|
||||
public void setIdTokenNonce(String idTokenNonce) {
|
||||
this.idTokenNonce = idTokenNonce;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify whether an ID token should be acquired for hints, if available for the selected credential identifier.
|
||||
* This is enabled by default; disable this if your app does not use ID tokens as part of authentication to decrease latency in retrieving credentials and credential hints.
|
||||
*/
|
||||
public void setIdTokenRequested(boolean idTokenRequested) {
|
||||
this.idTokenRequested = idTokenRequested;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables returning {@link Credential} hints where the identifier is a phone number, intended for use with a password chosen by the user or SMS verification.
|
||||
*/
|
||||
public void setPhoneNumberIdentifierSupported(boolean phoneNumberIdentifierSupported) {
|
||||
this.phoneNumberIdentifierSupported = phoneNumberIdentifierSupported;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the server client ID for the backend associated with this app.
|
||||
* If a Google ID token can be generated for a retrieved credential or hint, and the specified server client ID is correctly configured to be associated with the app, then it will be used as the audience of the generated token.
|
||||
* If a null value is specified, the default audience will be used for the generated ID token.
|
||||
*/
|
||||
public void setServerClientId(String serverClientId) {
|
||||
this.serverClientId = serverClientId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2016, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.credentials;
|
||||
|
||||
import org.microg.gms.common.PublicApi;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
import org.microg.safeparcel.SafeParceled;
|
||||
|
||||
@PublicApi
|
||||
public class IdToken extends AutoSafeParcelable {
|
||||
|
||||
@Field(1000)
|
||||
private int versionCode = 1;
|
||||
|
||||
@Field(1)
|
||||
private String accountType;
|
||||
|
||||
@Field(2)
|
||||
private String id;
|
||||
|
||||
private IdToken() {
|
||||
}
|
||||
|
||||
public IdToken(String accountType, String id) {
|
||||
this.accountType = accountType;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code AccountManager} account type for the token.
|
||||
*/
|
||||
public String getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID token, formatted according to the rules defined by the account type.
|
||||
*/
|
||||
public String getIdToken() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static final Creator<IdToken> CREATOR = new AutoCreator<IdToken>(IdToken.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.credentials;
|
||||
|
||||
import android.accounts.Account;
|
||||
|
||||
/**
|
||||
* Identity provider constants for use with {@link CredentialRequest.Builder#setAccountTypes(String...)}
|
||||
*/
|
||||
public final class IdentityProviders {
|
||||
public static final String FACEBOOK = "//www.facebook.com";
|
||||
public static final String GOOGLE = "//accounts.google.com";
|
||||
public static final String LINKEDIN = "//www.linkedin.com";
|
||||
public static final String MICROSOFT = "//login.live.com";
|
||||
public static final String PAYPAL = "//www.paypal.com";
|
||||
public static final String TWITTER = "//twitter.com";
|
||||
public static final String YAHOO = "//login.yahoo.com";
|
||||
|
||||
/**
|
||||
* Attempts to translate the account type in the provided account into the string that should be used in the credentials API.
|
||||
*
|
||||
* @param account an account on the device.
|
||||
* @return The identity provider string for use with the Credentials API, or {@code null} if the account type is unknown.
|
||||
*/
|
||||
public static String getIdentityProviderForAccount(Account account) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (C) 2013-2017 microG Project Team
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.credentials.internal;
|
||||
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class DeleteRequest extends AutoSafeParcelable {
|
||||
public static final Creator<DeleteRequest> CREATOR = new AutoCreator<DeleteRequest>(DeleteRequest.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (C) 2013-2017 microG Project Team
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.credentials.internal;
|
||||
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class GeneratePasswordRequest extends AutoSafeParcelable {
|
||||
public static final Creator<GeneratePasswordRequest> CREATOR = new AutoCreator<GeneratePasswordRequest>(GeneratePasswordRequest.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (C) 2013-2017 microG Project Team
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.credentials.internal;
|
||||
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class SaveRequest extends AutoSafeParcelable {
|
||||
public static final Creator<SaveRequest> CREATOR = new AutoCreator<SaveRequest>(SaveRequest.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 microG Project Team
|
||||
* SPDX-License-Identifier: CC-BY-4.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
/**
|
||||
* Provides facilities to retrieve and save app login credentials.
|
||||
*/
|
||||
package com.google.android.gms.auth.api.credentials;
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.api.ApiException;
|
||||
import com.google.android.gms.common.api.HasApiKey;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
|
||||
/**
|
||||
* A client for the authorization API.
|
||||
*/
|
||||
public interface AuthorizationClient extends HasApiKey<AuthorizationOptions> {
|
||||
/**
|
||||
* Requests authorization to access the Google data associated with a signed-in account on the device.
|
||||
* <p>
|
||||
* If an eligible signed-in account is found for the application, this request will verify that all the requested OAuth 2.0 scopes were previously
|
||||
* granted by the user. If they were, the requested tokens will be returned in the result. If, however, no saved account is found or the required
|
||||
* grants do not exist, the result will contain a {@link PendingIntent} that can be used to launch the authorization flow. During that flow, the user will
|
||||
* be asked to select an account and/or grant the permission for all or a subset of requested scopes. An exception will be set on the returned
|
||||
* {@link Task} if authorization is not available on the device (for example, internal error or Play Services not available).
|
||||
*
|
||||
* @param request configuration for the authorization operation.
|
||||
* @return {@link Task} which contains the result of the operation.
|
||||
*/
|
||||
@NonNull
|
||||
Task<AuthorizationResult> authorize(@NonNull AuthorizationRequest request);
|
||||
|
||||
/**
|
||||
* Clears an access token from the local cache.
|
||||
*
|
||||
* @param request configuration for the clear token operation.
|
||||
* @return A Task that may be used to check for failure, success or completion
|
||||
*/
|
||||
@NonNull
|
||||
Task<Void> clearToken(@NonNull ClearTokenRequest request);
|
||||
|
||||
/**
|
||||
* Retrieves the {@link AuthorizationResult} from the {@link Intent} returned upon successful authorization, throwing an {@link ApiException} if no result is
|
||||
* present or authorization has failed.
|
||||
*
|
||||
* @throws ApiException
|
||||
*/
|
||||
@NonNull
|
||||
AuthorizationResult getAuthorizationResultFromIntent(@Nullable Intent intent) throws ApiException;
|
||||
|
||||
/**
|
||||
* Revokes access given to the current application. Future sign-in or authorization attempts will require the user to re-consent to all requested
|
||||
* scopes. Applications are required to provide users that are signed in with Google the ability to disconnect their Google account from the
|
||||
* app. If the user deletes their account, you must delete the information that your app obtained from the Google APIs.
|
||||
*
|
||||
* @param revokeAccessRequest configuration for the revoke authorization operation.
|
||||
* @return A Task that may be used to check for failure, success or completion
|
||||
*/
|
||||
@NonNull
|
||||
Task<Void> revokeAccess(@NonNull RevokeAccessRequest revokeAccessRequest);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import com.google.android.gms.common.api.Api;
|
||||
import org.microg.gms.common.Hide;
|
||||
|
||||
@Hide
|
||||
public class AuthorizationOptions implements Api.ApiOptions.Optional {
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.common.api.Scope;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SafeParcelable.Class
|
||||
public class AuthorizationRequest extends AbstractSafeParcelable {
|
||||
|
||||
@Field(1)
|
||||
public List<Scope> requestedScopes;
|
||||
@Field(2)
|
||||
public String serverClientId;
|
||||
@Field(3)
|
||||
public boolean serverAuthCodeRequested;
|
||||
@Field(4)
|
||||
public boolean idTokenRequested;
|
||||
@Field(5)
|
||||
public Account account;
|
||||
@Field(6)
|
||||
public String hostedDomainFilter;
|
||||
@Field(7)
|
||||
public String sessionId;
|
||||
@Field(8)
|
||||
public boolean forceCodeForRefreshToken;
|
||||
@Field(9)
|
||||
public Bundle bundle;
|
||||
@Field(10)
|
||||
public boolean offlineAccess;
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<AuthorizationRequest> CREATOR = findCreator(AuthorizationRequest.class);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AuthorizationRequest{" +
|
||||
"requestedScopes=" + requestedScopes +
|
||||
", serverClientId='" + serverClientId + '\'' +
|
||||
", serverAuthCodeRequested=" + serverAuthCodeRequested +
|
||||
", idTokenRequested=" + idTokenRequested +
|
||||
", account=" + account +
|
||||
", hostedDomainFilter='" + hostedDomainFilter + '\'' +
|
||||
", sessionId='" + sessionId + '\'' +
|
||||
", forceCodeForRefreshToken=" + forceCodeForRefreshToken +
|
||||
", bundle=" + bundle +
|
||||
", offlineAccess=" + offlineAccess +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
import org.microg.gms.common.Hide;
|
||||
import org.microg.gms.utils.ToStringHelper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Result returned from a request to authorize
|
||||
*/
|
||||
@SafeParcelable.Class
|
||||
public class AuthorizationResult extends AbstractSafeParcelable {
|
||||
|
||||
@Nullable
|
||||
@Field(value = 1, getterName = "getServerAuthCode")
|
||||
private final String serverAuthCode;
|
||||
@Nullable
|
||||
@Field(value = 2, getterName = "getAccessToken")
|
||||
private final String accessToken;
|
||||
@Nullable
|
||||
@Field(value = 3, getterName = "getIdToken")
|
||||
private final String idToken;
|
||||
@NonNull
|
||||
@Field(value = 4, getterName = "getGrantedScopes")
|
||||
private final List<String> grantedScopes;
|
||||
@Nullable
|
||||
@Field(value = 5, getterName = "toGoogleSignInAccount")
|
||||
private final GoogleSignInAccount googleSignInAccount;
|
||||
@Nullable
|
||||
@Field(value = 6, getterName = "getPendingIntent")
|
||||
private final PendingIntent pendingIntent;
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<AuthorizationResult> CREATOR = findCreator(AuthorizationResult.class);
|
||||
|
||||
@Constructor
|
||||
public AuthorizationResult(@Nullable @Param(1) String serverAuthCode, @Nullable @Param(2) String accessToken, @Nullable @Param(3) String idToken, @NonNull @Param(4) List<String> grantedScopes, @Nullable @Param(5) GoogleSignInAccount googleSignInAccount, @Nullable @Param(6) PendingIntent pendingIntent) {
|
||||
this.serverAuthCode = serverAuthCode;
|
||||
this.accessToken = accessToken;
|
||||
this.idToken = idToken;
|
||||
this.grantedScopes = grantedScopes;
|
||||
this.googleSignInAccount = googleSignInAccount;
|
||||
this.pendingIntent = pendingIntent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
if (!(o instanceof AuthorizationResult)) return false;
|
||||
|
||||
AuthorizationResult that = (AuthorizationResult) o;
|
||||
return Objects.equals(serverAuthCode, that.serverAuthCode) && Objects.equals(accessToken, that.accessToken) && Objects.equals(idToken, that.idToken) && grantedScopes.equals(that.grantedScopes) && Objects.equals(pendingIntent, that.pendingIntent) && Objects.equals(googleSignInAccount, that.googleSignInAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the access token.
|
||||
*/
|
||||
@Nullable
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of scopes that user had granted access to.
|
||||
*/
|
||||
@NonNull
|
||||
public List<String> getGrantedScopes() {
|
||||
return grantedScopes;
|
||||
}
|
||||
|
||||
@Hide
|
||||
@Nullable
|
||||
public String getIdToken() {
|
||||
return idToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link PendingIntent} that can be used to launch the authorization flow.
|
||||
*/
|
||||
@Nullable
|
||||
public PendingIntent getPendingIntent() {
|
||||
return pendingIntent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the server authorization code that can be exchanged by the server for a refresh token.
|
||||
*/
|
||||
@Nullable
|
||||
public String getServerAuthCode() {
|
||||
return serverAuthCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if this result contains a resolution that needs to be launched.
|
||||
* <p>
|
||||
* Please see {@link #getPendingIntent()} for additional context.
|
||||
*/
|
||||
public boolean hasResolution() {
|
||||
return pendingIntent != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts this result to an equivalent {@link GoogleSignInAccount} object, if the authorization operation was successful in returning tokens. If,
|
||||
* instead, a {@link PendingIntent} was provided to launch the authorization flow, this will return {@code null}.
|
||||
*
|
||||
* @return a {@link GoogleSignInAccount} object with the same data contained in this result.
|
||||
*/
|
||||
@Nullable
|
||||
public GoogleSignInAccount toGoogleSignInAccount() {
|
||||
return googleSignInAccount;
|
||||
}
|
||||
|
||||
@Hide
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringHelper.name("AuthorizationResult")
|
||||
.field("serverAuthCode", serverAuthCode)
|
||||
.field("accessToken", accessToken)
|
||||
.field("idToken", idToken)
|
||||
.field("grantedScopes", grantedScopes)
|
||||
.field("pendingIntent", pendingIntent)
|
||||
.field("googleSignInAccount", googleSignInAccount)
|
||||
.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(new Object[]{serverAuthCode, accessToken, idToken, grantedScopes, pendingIntent, googleSignInAccount});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,660 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialRequestOptions;
|
||||
import org.microg.gms.common.Hide;
|
||||
import org.microg.gms.utils.ToStringHelper;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Configurations that can be used to filter acceptable types of credentials returned from a sign-in attempt.
|
||||
*/
|
||||
@SafeParcelable.Class
|
||||
public class BeginSignInRequest extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "getPasswordRequestOptions")
|
||||
private final PasswordRequestOptions passwordRequestOptions;
|
||||
@Field(value = 2, getterName = "getGoogleIdTokenRequestOptions")
|
||||
private final GoogleIdTokenRequestOptions googleIdTokenRequestOptions;
|
||||
@Field(value = 3, getterName = "getSessionId")
|
||||
private final String sessionId;
|
||||
@Field(value = 4, getterName = "isAutoSelectEnabled")
|
||||
private final boolean autoSelectEnabled;
|
||||
@Field(value = 5, getterName = "getTheme")
|
||||
private final int theme;
|
||||
@Field(value = 6, getterName = "getPasskeysRequestOptions")
|
||||
private final PasskeysRequestOptions passkeysRequestOptions;
|
||||
@Field(value = 7, getterName = "getPasskeyJsonRequestOptions")
|
||||
private final PasskeyJsonRequestOptions passkeyJsonRequestOptions;
|
||||
@Field(value = 8, getterName = "isPreferImmediatelyAvailableCredentials")
|
||||
private final boolean preferImmediatelyAvailableCredentials;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringHelper.name("BeginSignInRequest")
|
||||
.field("PasswordRequestOptions", passwordRequestOptions)
|
||||
.field("GoogleIdTokenRequestOptions", googleIdTokenRequestOptions)
|
||||
.field("sessionId", sessionId)
|
||||
.field("autoSelectEnabled", autoSelectEnabled)
|
||||
.field("theme", theme)
|
||||
.field("PasskeysRequestOptions", passkeysRequestOptions)
|
||||
.field("PasskeyJsonRequestOptions", passkeyJsonRequestOptions)
|
||||
.field("preferImmediatelyAvailableCredentials", preferImmediatelyAvailableCredentials)
|
||||
.end();
|
||||
}
|
||||
|
||||
@Constructor
|
||||
BeginSignInRequest(@Param(1) PasswordRequestOptions passwordRequestOptions, @Param(2) GoogleIdTokenRequestOptions googleIdTokenRequestOptions, @Param(3) String sessionId, @Param(4) boolean autoSelectEnabled, @Param(5) int theme, @Param(6) PasskeysRequestOptions passkeysRequestOptions, @Param(7) PasskeyJsonRequestOptions passkeyJsonRequestOptions, @Param(8) boolean preferImmediatelyAvailableCredentials) {
|
||||
this.passwordRequestOptions = passwordRequestOptions;
|
||||
this.googleIdTokenRequestOptions = googleIdTokenRequestOptions;
|
||||
this.sessionId = sessionId;
|
||||
this.autoSelectEnabled = autoSelectEnabled;
|
||||
this.theme = theme;
|
||||
this.passkeysRequestOptions = passkeysRequestOptions;
|
||||
this.passkeyJsonRequestOptions = passkeyJsonRequestOptions;
|
||||
this.preferImmediatelyAvailableCredentials = preferImmediatelyAvailableCredentials;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public GoogleIdTokenRequestOptions getGoogleIdTokenRequestOptions() {
|
||||
return googleIdTokenRequestOptions;
|
||||
}
|
||||
|
||||
public PasskeyJsonRequestOptions getPasskeyJsonRequestOptions() {
|
||||
return passkeyJsonRequestOptions;
|
||||
}
|
||||
|
||||
public PasskeysRequestOptions getPasskeysRequestOptions() {
|
||||
return passkeysRequestOptions;
|
||||
}
|
||||
|
||||
public PasswordRequestOptions getPasswordRequestOptions() {
|
||||
return passwordRequestOptions;
|
||||
}
|
||||
|
||||
@Hide
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@Hide
|
||||
public int getTheme() {
|
||||
return theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if auto-select is requested, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isAutoSelectEnabled() {
|
||||
return autoSelectEnabled;
|
||||
}
|
||||
|
||||
public boolean isPreferImmediatelyAvailableCredentials() {
|
||||
return preferImmediatelyAvailableCredentials;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for requesting Google ID token-backed credentials during sign-in.
|
||||
*/
|
||||
@Class
|
||||
public static class GoogleIdTokenRequestOptions extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "isSupported")
|
||||
private final boolean supported;
|
||||
@Field(value = 2, getterName = "getServerClientId")
|
||||
private final String serverClientId;
|
||||
@Field(value = 3, getterName = "getNonce")
|
||||
private final String nonce;
|
||||
@Field(value = 4, getterName = "filterByAuthorizedAccounts")
|
||||
private final boolean filterByAuthorizedAccounts;
|
||||
@Field(value = 5, getterName = "getLinkedServiceId")
|
||||
private final String linkedServiceId;
|
||||
@Field(value = 6, getterName = "getIdTokenDepositionScopes")
|
||||
private final List<String> idTokenDepositionScopes;
|
||||
@Field(value = 7, getterName = "requestVerifiedPhoneNumber")
|
||||
private final boolean requestVerifiedPhoneNumber;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringHelper.name("GoogleIdTokenRequestOptions")
|
||||
.field("supported", supported)
|
||||
.field("serverClientId", serverClientId)
|
||||
.field("nonce", nonce)
|
||||
.field("filterByAuthorizedAccounts", filterByAuthorizedAccounts)
|
||||
.field("linkedServiceId", linkedServiceId)
|
||||
.field("idTokenDepositionScopes", idTokenDepositionScopes)
|
||||
.field("requestVerifiedPhoneNumber", requestVerifiedPhoneNumber)
|
||||
.end();
|
||||
}
|
||||
|
||||
@Hide
|
||||
@Constructor
|
||||
public GoogleIdTokenRequestOptions(@Param(1) boolean supported, @Param(2) String serverClientId, @Param(3) String nonce, @Param(4) boolean filterByAuthorizedAccounts, @Param(5) String linkedServiceId, @Param(6) List<String> idTokenDepositionScopes, @Param(7) boolean requestVerifiedPhoneNumber) {
|
||||
this.supported = supported;
|
||||
this.serverClientId = serverClientId;
|
||||
this.nonce = nonce;
|
||||
this.filterByAuthorizedAccounts = filterByAuthorizedAccounts;
|
||||
this.linkedServiceId = linkedServiceId;
|
||||
this.idTokenDepositionScopes = idTokenDepositionScopes;
|
||||
this.requestVerifiedPhoneNumber = requestVerifiedPhoneNumber;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public boolean filterByAuthorizedAccounts() {
|
||||
return filterByAuthorizedAccounts;
|
||||
}
|
||||
|
||||
public List<String> getIdTokenDepositionScopes() {
|
||||
return idTokenDepositionScopes;
|
||||
}
|
||||
|
||||
public String getLinkedServiceId() {
|
||||
return linkedServiceId;
|
||||
}
|
||||
|
||||
public String getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
public String getServerClientId() {
|
||||
return serverClientId;
|
||||
}
|
||||
|
||||
public boolean isSupported() {
|
||||
return supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated No replacement.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean requestVerifiedPhoneNumber() {
|
||||
return requestVerifiedPhoneNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for {@link BeginSignInRequest.GoogleIdTokenRequestOptions}.
|
||||
*/
|
||||
public static class Builder {
|
||||
private boolean supported;
|
||||
@Nullable
|
||||
private String serverClientId;
|
||||
@Nullable
|
||||
private String nonce;
|
||||
private boolean filterByAuthorizedAccounts = true;
|
||||
@Nullable
|
||||
private String linkedServiceId;
|
||||
@Nullable
|
||||
private List<String> idTokenDepositionScopes;
|
||||
private boolean requestVerifiedPhoneNumber;
|
||||
|
||||
/**
|
||||
* Sets whether to support sign-in using Google accounts that are linked to your users' accounts.
|
||||
* <p>
|
||||
* When such a credential is selected, a Google ID token for the Google account that the selected account is linked to, will
|
||||
* first be deposited to your server and then returned to you. Similar to the regular sign-in, your backend could use the ID
|
||||
* token to sign the user in. Note that, the ID token deposition will only happen the first time signing in, using this credential.
|
||||
* Subsequent sign-ins will not require a deposition, since the ID token will already have been associated with your user's
|
||||
* account.
|
||||
*
|
||||
* @param linkedServiceId service ID used when linking accounts to a Google account.
|
||||
* @param idTokenDepositionScopes Oauth scopes that Google will need to deposit a Google ID token to your application's backend server. This
|
||||
* is optional and can be set to null. Only required if Google requires particular scopes to be able to deposit
|
||||
* the ID token.
|
||||
*/
|
||||
public Builder associateLinkedAccounts(@NonNull String linkedServiceId, @Nullable List<String> idTokenDepositionScopes) {
|
||||
this.linkedServiceId = linkedServiceId;
|
||||
this.idTokenDepositionScopes = idTokenDepositionScopes;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the built {@link BeginSignInRequest.GoogleIdTokenRequestOptions}.
|
||||
*/
|
||||
@NonNull
|
||||
public GoogleIdTokenRequestOptions build() {
|
||||
return new GoogleIdTokenRequestOptions(supported, serverClientId, nonce, filterByAuthorizedAccounts, linkedServiceId, idTokenDepositionScopes, requestVerifiedPhoneNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to only allow the user to select from Google accounts that are already authorized to sign in to your
|
||||
* application. The default value is true.
|
||||
* <p>
|
||||
* If {@code true}, the user will not be able to select any Google account that would otherwise require explicit authorization to
|
||||
* share basic profile/email data with your application. This may reduce some friction in the sign-in user journey, and
|
||||
* guarantees that the returned credential is for a "returning user", but limits the user's freedom to choose among all the
|
||||
* Google accounts on the device.
|
||||
*
|
||||
* @param filterByAuthorizedAccounts whether to only allow the user to select from Google accounts that are already authorized to sign in to
|
||||
* your application
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setFilterByAuthorizedAccounts(boolean filterByAuthorizedAccounts) {
|
||||
this.filterByAuthorizedAccounts = filterByAuthorizedAccounts;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the nonce to use when generating a Google ID token.
|
||||
*
|
||||
* @param nonce the nonce to use during ID token generation
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setNonce(@Nullable String nonce) {
|
||||
this.nonce = nonce;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to request for a verified phone number during sign-ups.
|
||||
* <p>
|
||||
* In order to use this feature, the
|
||||
* {@link BeginSignInRequest.GoogleIdTokenRequestOptions#filterByAuthorizedAccounts()} field must be explicitly set
|
||||
* to false, because this feature is only available during sign-ups.
|
||||
*
|
||||
* @deprecated No replacement.
|
||||
*/
|
||||
@Deprecated
|
||||
@NonNull
|
||||
public Builder setRequestVerifiedPhoneNumber(boolean requestVerifiedPhoneNumber) {
|
||||
this.requestVerifiedPhoneNumber = requestVerifiedPhoneNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the server's client ID to use as the audience for Google ID tokens generated during the sign-in.
|
||||
*
|
||||
* @param serverClientId the client ID of the server to which the ID token will be issued
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setServerClientId(@NonNull String serverClientId) {
|
||||
this.serverClientId = serverClientId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether Google ID token-backed credentials should be returned by the API.
|
||||
*
|
||||
* @param supported whether Google ID token-backed credentials should be returned
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setSupported(boolean supported) {
|
||||
this.supported = supported;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof GoogleIdTokenRequestOptions)) return false;
|
||||
|
||||
GoogleIdTokenRequestOptions that = (GoogleIdTokenRequestOptions) o;
|
||||
|
||||
if (supported != that.supported) return false;
|
||||
if (filterByAuthorizedAccounts != that.filterByAuthorizedAccounts) return false;
|
||||
if (requestVerifiedPhoneNumber != that.requestVerifiedPhoneNumber) return false;
|
||||
if (!Objects.equals(serverClientId, that.serverClientId)) return false;
|
||||
if (!Objects.equals(nonce, that.nonce)) return false;
|
||||
if (!Objects.equals(linkedServiceId, that.linkedServiceId)) return false;
|
||||
return Objects.equals(idTokenDepositionScopes, that.idTokenDepositionScopes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(new Object[]{supported, serverClientId, nonce, filterByAuthorizedAccounts, linkedServiceId, idTokenDepositionScopes, requestVerifiedPhoneNumber});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<GoogleIdTokenRequestOptions> CREATOR = findCreator(GoogleIdTokenRequestOptions.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for requesting passkeys during sign-in.
|
||||
*/
|
||||
@Class
|
||||
public static class PasskeyJsonRequestOptions extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "isSupported")
|
||||
private final boolean supported;
|
||||
@Field(value = 2, getterName = "getRequestJson")
|
||||
private final String requestJson;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringHelper.name("PasskeyJsonRequestOptions")
|
||||
.field("supported", supported)
|
||||
.field("requestJson", requestJson)
|
||||
.end();
|
||||
}
|
||||
|
||||
@Constructor
|
||||
@Hide
|
||||
public PasskeyJsonRequestOptions(@Param(1) boolean supported, @Param(2) String requestJson) {
|
||||
this.supported = supported;
|
||||
this.requestJson = requestJson;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public String getRequestJson() {
|
||||
return requestJson;
|
||||
}
|
||||
|
||||
public boolean isSupported() {
|
||||
return supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for {@link BeginSignInRequest.PasskeyJsonRequestOptions}.
|
||||
*/
|
||||
public static class Builder {
|
||||
private boolean supported;
|
||||
private String requestJson;
|
||||
|
||||
@NonNull
|
||||
public PasskeyJsonRequestOptions build() {
|
||||
return new PasskeyJsonRequestOptions(supported, requestJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link PublicKeyCredentialRequestOptions} in JSON format.
|
||||
*
|
||||
* @param requestJson the JSON formatted representation of the WebAuthn request.
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setRequestJson(@NonNull String requestJson) {
|
||||
this.requestJson = requestJson;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether passkey credentials should be returned by this API.
|
||||
*
|
||||
* @param supported whether passkey credentials should be returned
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setSupported(boolean supported) {
|
||||
this.supported = supported;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof PasskeyJsonRequestOptions)) return false;
|
||||
|
||||
PasskeyJsonRequestOptions that = (PasskeyJsonRequestOptions) o;
|
||||
|
||||
if (supported != that.supported) return false;
|
||||
return Objects.equals(requestJson, that.requestJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(new Object[]{supported, requestJson});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<PasskeyJsonRequestOptions> CREATOR = findCreator(PasskeyJsonRequestOptions.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for requesting passkeys during sign-in.
|
||||
*
|
||||
* @deprecated Use {@link BeginSignInRequest.PasskeyJsonRequestOptions} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Class
|
||||
public static class PasskeysRequestOptions extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "isSupported")
|
||||
private final boolean supported;
|
||||
@Field(value = 2, getterName = "getChallenge")
|
||||
private final byte[] challenge;
|
||||
@Field(value = 3, getterName = "getRpId")
|
||||
private final String rpId;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringHelper.name("PasskeysRequestOptions")
|
||||
.field("supported", supported)
|
||||
.field("challenge", challenge)
|
||||
.field("rpId", rpId)
|
||||
.end();
|
||||
}
|
||||
|
||||
@Constructor
|
||||
@Hide
|
||||
public PasskeysRequestOptions(@Param(1) boolean supported, @Param(2) byte[] challenge, @Param(3) String rpId) {
|
||||
this.supported = supported;
|
||||
this.challenge = challenge;
|
||||
this.rpId = rpId;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public byte[] getChallenge() {
|
||||
return challenge;
|
||||
}
|
||||
|
||||
public String getRpId() {
|
||||
return rpId;
|
||||
}
|
||||
|
||||
public boolean isSupported() {
|
||||
return supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for {@link BeginSignInRequest.PasskeysRequestOptions}.
|
||||
*/
|
||||
public static class Builder {
|
||||
private boolean supported;
|
||||
private byte[] challenge;
|
||||
private String rpId;
|
||||
|
||||
public PasskeysRequestOptions build() {
|
||||
return new PasskeysRequestOptions(supported, challenge, rpId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the nonce value that the authenticator should sign using a private key corresponding to a public key credential that
|
||||
* is acceptable for this authentication session.
|
||||
*
|
||||
* @param challenge the challenge
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setChallenge(@NonNull byte[] challenge) {
|
||||
this.challenge = challenge;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets identifier for a relying party, on whose behalf a given authentication operation is being performed. A public key
|
||||
* credential can only be used for authentication with the same replying party it was registered with.
|
||||
* <p>
|
||||
* Note: the RpId should be an effective domain (without scheme or port).
|
||||
*
|
||||
* @param rpId identifier for a relying party
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setRpId(@NonNull String rpId) {
|
||||
this.rpId = rpId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether passkey credentials should be returned by this API.
|
||||
*
|
||||
* @param supported whether passkey credentials should be returned
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setSupported(boolean supported) {
|
||||
this.supported = supported;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof PasskeysRequestOptions)) return false;
|
||||
|
||||
PasskeysRequestOptions that = (PasskeysRequestOptions) o;
|
||||
|
||||
if (supported != that.supported) return false;
|
||||
if (!Arrays.equals(challenge, that.challenge)) return false;
|
||||
return Objects.equals(rpId, that.rpId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(new Object[]{supported, challenge, rpId});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<PasskeysRequestOptions> CREATOR = findCreator(PasskeysRequestOptions.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for requesting password-backed credentials during sign-in.
|
||||
*/
|
||||
@Class
|
||||
public static class PasswordRequestOptions extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "isSupported")
|
||||
public final boolean supported;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringHelper.name("PasswordRequestOptions")
|
||||
.field("supported", supported)
|
||||
.end();
|
||||
}
|
||||
|
||||
@Constructor
|
||||
@Hide
|
||||
public PasswordRequestOptions(@Param(1) boolean supported) {
|
||||
this.supported = supported;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public boolean isSupported() {
|
||||
return supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for {@link BeginSignInRequest.PasswordRequestOptions}.
|
||||
*/
|
||||
public static class Builder {
|
||||
private boolean supported = false;
|
||||
|
||||
/**
|
||||
* Returns the built {@link BeginSignInRequest.PasswordRequestOptions}.
|
||||
*/
|
||||
@NonNull
|
||||
public PasswordRequestOptions build() {
|
||||
return new PasswordRequestOptions(supported);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether password-backed credentials should be returned by the API.
|
||||
*
|
||||
* @param supported whether password-backed credentials should be returned
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setSupported(boolean supported) {
|
||||
this.supported = supported;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<PasswordRequestOptions> CREATOR = findCreator(PasswordRequestOptions.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof BeginSignInRequest)) return false;
|
||||
|
||||
BeginSignInRequest that = (BeginSignInRequest) o;
|
||||
|
||||
if (autoSelectEnabled != that.autoSelectEnabled) return false;
|
||||
if (theme != that.theme) return false;
|
||||
if (!Objects.equals(passwordRequestOptions, that.passwordRequestOptions)) return false;
|
||||
if (!Objects.equals(googleIdTokenRequestOptions, that.googleIdTokenRequestOptions))
|
||||
return false;
|
||||
if (!Objects.equals(sessionId, that.sessionId)) return false;
|
||||
if (!Objects.equals(passkeysRequestOptions, that.passkeysRequestOptions)) return false;
|
||||
return Objects.equals(passkeyJsonRequestOptions, that.passkeyJsonRequestOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(new Object[]{passwordRequestOptions, googleIdTokenRequestOptions, sessionId, autoSelectEnabled, theme, passkeysRequestOptions, passkeyJsonRequestOptions});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<BeginSignInRequest> CREATOR = findCreator(BeginSignInRequest.class);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
import org.microg.gms.common.Hide;
|
||||
|
||||
/**
|
||||
* Result returned from sign-in initiation that includes a {@link PendingIntent} that can be used to continue the sign-in flow.
|
||||
*/
|
||||
@SafeParcelable.Class
|
||||
public class BeginSignInResult extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "getPendingIntent")
|
||||
private final PendingIntent pendingIntent;
|
||||
|
||||
@Constructor
|
||||
@Hide
|
||||
public BeginSignInResult(@Param(1) PendingIntent pendingIntent) {
|
||||
this.pendingIntent = pendingIntent;
|
||||
}
|
||||
|
||||
public PendingIntent getPendingIntent() {
|
||||
return pendingIntent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<BeginSignInResult> CREATOR = findCreator(BeginSignInResult.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.os.Parcel;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
import org.microg.gms.common.Hide;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Parameters that configure the Clear token request.
|
||||
*/
|
||||
@SafeParcelable.Class
|
||||
public class ClearTokenRequest extends AbstractSafeParcelable {
|
||||
@NonNull
|
||||
@Field(value = 1, getterName = "getToken")
|
||||
private final String token;
|
||||
@Nullable
|
||||
@Field(value = 2, getterName = "getSessionId")
|
||||
private final String sessionId;
|
||||
|
||||
public static SafeParcelableCreatorAndWriter<ClearTokenRequest> CREATOR = findCreator(ClearTokenRequest.class);
|
||||
|
||||
@Constructor
|
||||
ClearTokenRequest(@NonNull @Param(1) String token, @Nullable @Param(2) String sessionId) {
|
||||
this.token = token;
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link ClearTokenRequest.Builder}.
|
||||
*/
|
||||
public static ClearTokenRequest.Builder builder() {
|
||||
return new ClearTokenRequest.Builder() {
|
||||
@Nullable
|
||||
private String token;
|
||||
@Nullable
|
||||
private String sessionId;
|
||||
|
||||
@Override
|
||||
public ClearTokenRequest build() {
|
||||
if (token == null) {
|
||||
throw new IllegalStateException("Missing required properties: token");
|
||||
}
|
||||
return new ClearTokenRequest(token, sessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClearTokenRequest.Builder setToken(@NonNull String token) {
|
||||
this.token = token;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClearTokenRequest.Builder setSessionId(@Nullable String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
return this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
if (!(o instanceof ClearTokenRequest)) return false;
|
||||
|
||||
ClearTokenRequest that = (ClearTokenRequest) o;
|
||||
return token.equals(that.token) && Objects.equals(sessionId, that.sessionId);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
@Hide
|
||||
@Nullable
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(new Object[]{token, sessionId});
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for {@link ClearTokenRequest}.
|
||||
*/
|
||||
public static abstract class Builder {
|
||||
/**
|
||||
* Builds the {@link ClearTokenRequest}.
|
||||
*/
|
||||
public abstract ClearTokenRequest build();
|
||||
|
||||
/**
|
||||
* Sets the token being cleared from the cache.
|
||||
*/
|
||||
public abstract ClearTokenRequest.Builder setToken(String token);
|
||||
|
||||
@Hide
|
||||
public abstract ClearTokenRequest.Builder setSessionId(String sessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel parcel, int flags) {
|
||||
CREATOR.writeToParcel(this, parcel, flags);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.api.HasApiKey;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
|
||||
/**
|
||||
* A client for the Credential Saving API.
|
||||
*/
|
||||
public interface CredentialSavingClient extends HasApiKey<CredentialSavingOptions> {
|
||||
/**
|
||||
* Extracts the {@link Status} from the {@link Intent} object in activity results.
|
||||
*/
|
||||
@NonNull
|
||||
Status getStatusFromIntent(@Nullable Intent intent);
|
||||
|
||||
/**
|
||||
* Attempts to save a token for account linking.
|
||||
* <p>
|
||||
* Calling this method will provide a {@link PendingIntent} in the response that can be used to launch the flow to complete the
|
||||
* saving of the account linking token. As part of the request, you need to provide a {@link PendingIntent} for your consent page
|
||||
* that Google Play services will launch in the middle of the flow. The result must then be sent back to the caller following a
|
||||
* certain contract described in {@link SaveAccountLinkingTokenRequest.Builder#setConsentPendingIntent(PendingIntent)}.
|
||||
*
|
||||
* @param saveAccountLinkingTokenRequest the request that contains the parameters to successfully return a response that can be used to
|
||||
* launch the appropriate flow.
|
||||
* @return {@link Task} which may contain the {@link PendingIntent} required to launch the flow. To find out if the response can be used
|
||||
* to start the flow, first call {@link SaveAccountLinkingTokenResult#hasResolution()}.
|
||||
*/
|
||||
@NonNull
|
||||
Task<SaveAccountLinkingTokenResult> saveAccountLinkingToken(@NonNull SaveAccountLinkingTokenRequest saveAccountLinkingTokenRequest);
|
||||
|
||||
/**
|
||||
* Initiates the storage of a password-backed credential that can later be used to sign a user in.
|
||||
* <p>
|
||||
* If the request cannot be honored, an exception will be set on the returned {@link Task}. In all other cases, a
|
||||
* {@link SavePasswordResult} will be returned.
|
||||
*
|
||||
* @param savePasswordRequest container for the {@link SignInPassword} for the password-saving flow
|
||||
* @return {@link Task} which eventually contains the result of the initialization
|
||||
*/
|
||||
@NonNull
|
||||
Task<SavePasswordResult> savePassword(@NonNull SavePasswordRequest savePasswordRequest);
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.api.Api;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class CredentialSavingOptions implements Api.ApiOptions.Optional {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(new Object[]{CredentialSavingOptions.class});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
return obj instanceof CredentialSavingOptions;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
import org.microg.gms.common.Hide;
|
||||
|
||||
/**
|
||||
* Request object used to get an Intent to start the Phone Number Hint flow.
|
||||
*/
|
||||
@SafeParcelable.Class
|
||||
public class GetPhoneNumberHintIntentRequest extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "getTheme")
|
||||
private final int theme;
|
||||
|
||||
@Constructor
|
||||
GetPhoneNumberHintIntentRequest(@Param(1) int theme) {
|
||||
this.theme = theme;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Hide
|
||||
public int getTheme() {
|
||||
return theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for {@link GetPhoneNumberHintIntentRequest}
|
||||
*/
|
||||
public static class Builder {
|
||||
private int theme;
|
||||
|
||||
@NonNull
|
||||
public GetPhoneNumberHintIntentRequest build() {
|
||||
return new GetPhoneNumberHintIntentRequest(theme);
|
||||
}
|
||||
|
||||
@Hide
|
||||
@NonNull
|
||||
public Builder setTheme(int theme) {
|
||||
this.theme = theme;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<GetPhoneNumberHintIntentRequest> CREATOR = findCreator(GetPhoneNumberHintIntentRequest.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,214 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
import org.microg.gms.common.Hide;
|
||||
import org.microg.gms.utils.ToStringHelper;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Request to get a Google sign-in intent.
|
||||
*/
|
||||
@SafeParcelable.Class
|
||||
public class GetSignInIntentRequest extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "getServerClientId")
|
||||
private final String serverClientId;
|
||||
@Field(value = 2, getterName = "getHostedDomainFilter")
|
||||
private final String hostedDomainFilter;
|
||||
@Field(value = 3, getterName = "getSessionId")
|
||||
private final String sessionId;
|
||||
@Field(value = 4, getterName = "getNonce")
|
||||
private final String nonce;
|
||||
@Field(value = 5, getterName = "requestVerifiedPhoneNumber")
|
||||
private final boolean requestVerifiedPhoneNumber;
|
||||
@Field(value = 6, getterName = "getTheme")
|
||||
private final int theme;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringHelper.name("GetSignInIntentRequest")
|
||||
.field("serverClientId", serverClientId)
|
||||
.field("hostedDomainFilter", hostedDomainFilter)
|
||||
.field("sessionId", sessionId)
|
||||
.field("nonce", nonce)
|
||||
.field("requestVerifiedPhoneNumber", requestVerifiedPhoneNumber)
|
||||
.field("theme", theme)
|
||||
.end();
|
||||
}
|
||||
|
||||
@Constructor
|
||||
GetSignInIntentRequest(@Param(1) String serverClientId, @Param(2) String hostedDomainFilter, @Param(3) String sessionId, @Param(4) String nonce, @Param(5) boolean requestVerifiedPhoneNumber, @Param(6) int theme) {
|
||||
this.serverClientId = serverClientId;
|
||||
this.hostedDomainFilter = hostedDomainFilter;
|
||||
this.sessionId = sessionId;
|
||||
this.nonce = nonce;
|
||||
this.requestVerifiedPhoneNumber = requestVerifiedPhoneNumber;
|
||||
this.theme = theme;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@code hostedDomainFilter} if it was set in the request, or {@code null} otherwise.
|
||||
*/
|
||||
public String getHostedDomainFilter() {
|
||||
return hostedDomainFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nonce that was set in the request.
|
||||
*/
|
||||
public String getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@code serverClientId} that was set in the request.
|
||||
*/
|
||||
public String getServerClientId() {
|
||||
return serverClientId;
|
||||
}
|
||||
|
||||
@Hide
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@Hide
|
||||
public int getTheme() {
|
||||
return theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether a verified phone number is requested.
|
||||
*
|
||||
* @deprecated No replacement.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean requestVerifiedPhoneNumber() {
|
||||
return requestVerifiedPhoneNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder class for {@link GetSignInIntentRequest}.
|
||||
*/
|
||||
public static class Builder {
|
||||
private String serverClientId;
|
||||
private String hostedDomainFilter;
|
||||
private String sessionId;
|
||||
private String nonce;
|
||||
private boolean requestVerifiedPhoneNumber;
|
||||
private int theme;
|
||||
|
||||
@NonNull
|
||||
public GetSignInIntentRequest build() {
|
||||
return new GetSignInIntentRequest(serverClientId, hostedDomainFilter, sessionId, nonce, requestVerifiedPhoneNumber, theme);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the hosted domain filter (e.g. myuniveristy.edu). Default is no filter.
|
||||
*/
|
||||
@NonNull
|
||||
public Builder filterByHostedDomain(@Nullable String hostedDomainFilter) {
|
||||
this.hostedDomainFilter = hostedDomainFilter;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the nonce to use when generating a Google ID token. The values for nonce can be any random string and is used to
|
||||
* prevent replay-attack. Default is no nonce.
|
||||
*
|
||||
* @param nonce the nonce to use during ID token generation
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setNonce(@Nullable String nonce) {
|
||||
this.nonce = nonce;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to prompt the users to share a verified phone number associated with their Google accounts.
|
||||
* <p>
|
||||
* Note that if the user selects a Google account which has previously been used to sign up to your app, they won't be
|
||||
* prompted with the phone number selection.
|
||||
*
|
||||
* @deprecated No replacement.
|
||||
*/
|
||||
@Deprecated
|
||||
@NonNull
|
||||
public Builder setRequestVerifiedPhoneNumber(boolean requestsVerifiedPhoneNumber) {
|
||||
this.requestVerifiedPhoneNumber = requestsVerifiedPhoneNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the client ID of the server that will verify the integrity of the token. Calling this method to set the {@code serverClientId} is
|
||||
* required.
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setServerClientId(@NonNull String serverClientId) {
|
||||
this.serverClientId = serverClientId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public Builder setSessionId(@Nullable String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public Builder setTheme(int theme) {
|
||||
this.theme = theme;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof GetSignInIntentRequest)) return false;
|
||||
|
||||
GetSignInIntentRequest that = (GetSignInIntentRequest) o;
|
||||
|
||||
if (requestVerifiedPhoneNumber != that.requestVerifiedPhoneNumber) return false;
|
||||
if (theme != that.theme) return false;
|
||||
if (!Objects.equals(serverClientId, that.serverClientId)) return false;
|
||||
if (!Objects.equals(hostedDomainFilter, that.hostedDomainFilter)) return false;
|
||||
if (!Objects.equals(sessionId, that.sessionId)) return false;
|
||||
return Objects.equals(nonce, that.nonce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(new Object[]{serverClientId, hostedDomainFilter, serverClientId, nonce, requestVerifiedPhoneNumber, theme});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<GetSignInIntentRequest> CREATOR = findCreator(GetSignInIntentRequest.class);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* The entry point to the Sign-In APIs.
|
||||
*/
|
||||
public final class Identity {
|
||||
|
||||
// /**
|
||||
// * Returns a new instance of {@link AuthorizationClient}.
|
||||
// */
|
||||
// @NonNull
|
||||
// public static AuthorizationClient getAuthorizationClient(@NonNull Context context) {
|
||||
// throw new UnsupportedOperationException();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns a new instance of {@link AuthorizationClient}.
|
||||
// */
|
||||
// @NonNull
|
||||
// public static AuthorizationClient getAuthorizationClient(@NonNull Activity activity) {
|
||||
// throw new UnsupportedOperationException();
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns a new instance of {@link CredentialSavingClient}.
|
||||
*/
|
||||
@NonNull
|
||||
public static CredentialSavingClient getCredentialSavingClient(@NonNull Activity activity) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of {@link CredentialSavingClient}.
|
||||
*/
|
||||
@NonNull
|
||||
public static CredentialSavingClient getCredentialSavingClient(@NonNull Context context) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of {@link SignInClient}.
|
||||
*/
|
||||
@NonNull
|
||||
public static SignInClient getSignInClient(@NonNull Activity activity) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of {@link SignInClient}.
|
||||
*/
|
||||
@NonNull
|
||||
public static SignInClient getSignInClient(@NonNull Context context) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private Identity() {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.os.Parcel;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.api.Scope;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
import org.microg.gms.common.Hide;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Parameters that configure the Revoke Access request.
|
||||
*/
|
||||
@SafeParcelable.Class
|
||||
public class RevokeAccessRequest extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "getScopes")
|
||||
@NonNull
|
||||
private final List<Scope> scopes;
|
||||
@Field(value = 2, getterName = "getAccount")
|
||||
@NonNull
|
||||
private final Account account;
|
||||
@Field(value = 3, getterName = "getSessionId")
|
||||
@Nullable
|
||||
private final String sessionId;
|
||||
|
||||
@Constructor
|
||||
RevokeAccessRequest(@NonNull @Param(1) List<Scope> scopes, @NonNull @Param(2) Account account, @Nullable @Param(3) String sessionId) {
|
||||
this.scopes = scopes;
|
||||
this.account = account;
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link RevokeAccessRequest.Builder}.
|
||||
*/
|
||||
@NonNull
|
||||
public static RevokeAccessRequest.Builder builder() {
|
||||
return new Builder() {
|
||||
private List<Scope> scopes;
|
||||
private Account account;
|
||||
private String sessionId;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RevokeAccessRequest build() {
|
||||
if (scopes == null) throw new IllegalStateException("Missing required properties: scopes");
|
||||
if (account == null) throw new IllegalStateException("Missing required properties: account");
|
||||
return new RevokeAccessRequest(scopes, account, sessionId);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Builder setAccount(@NonNull Account account) {
|
||||
this.account = account;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Builder setScopes(@NonNull List<Scope> scopes) {
|
||||
this.scopes = scopes;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Builder setSessionId(@Nullable String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
return this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the account that the application is revoking access for.
|
||||
*/
|
||||
@NonNull
|
||||
public Account getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the scopes that access is being revoked for.
|
||||
*/
|
||||
@NonNull
|
||||
public List<Scope> getScopes() {
|
||||
return scopes;
|
||||
}
|
||||
|
||||
@Hide
|
||||
@Nullable
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
if (!(o instanceof RevokeAccessRequest)) return false;
|
||||
|
||||
RevokeAccessRequest that = (RevokeAccessRequest) o;
|
||||
return scopes.equals(that.scopes) && account.equals(that.account) && Objects.equals(sessionId, that.sessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(new Object[]{scopes, account, sessionId});
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for {@link RevokeAccessRequest}.
|
||||
*/
|
||||
public static abstract class Builder {
|
||||
@NonNull
|
||||
public abstract RevokeAccessRequest build();
|
||||
|
||||
@NonNull
|
||||
public abstract Builder setAccount(@NonNull Account account);
|
||||
|
||||
@NonNull
|
||||
public abstract Builder setScopes(@NonNull List<Scope> scopes);
|
||||
|
||||
@NonNull
|
||||
@Hide
|
||||
public abstract Builder setSessionId(@Nullable String sessionId);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<RevokeAccessRequest> CREATOR = findCreator(RevokeAccessRequest.class);
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel parcel, int flags) {
|
||||
CREATOR.writeToParcel(this, parcel, flags);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,221 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.PendingIntent;
|
||||
import android.os.Parcel;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
import org.microg.gms.common.Hide;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Configurations that allow saving a token to Google for the purpose of account linking.
|
||||
*/
|
||||
public class SaveAccountLinkingTokenRequest extends AbstractSafeParcelable {
|
||||
public static final String EXTRA_TOKEN = "extra_token";
|
||||
/**
|
||||
* A constant to indicate that the type of token that will be saved is an Authorization Code.
|
||||
*/
|
||||
public static final String TOKEN_TYPE_AUTH_CODE = "auth_code";
|
||||
|
||||
@Field(value = 1, getterName = "getConsentPendingIntent")
|
||||
private final PendingIntent consentPendingIntent;
|
||||
@Field(value = 2, getterName = "getTokenType")
|
||||
private final String tokenType;
|
||||
@Field(value = 3, getterName = "getServiceId")
|
||||
private final String serviceId;
|
||||
@Field(value = 4, getterName = "getScopes")
|
||||
private final List<String> scopes;
|
||||
@Field(value = 5, getterName = "getSessionId")
|
||||
private final String sessionId;
|
||||
@Field(value = 6, getterName = "getTheme")
|
||||
private final int theme;
|
||||
|
||||
@Constructor
|
||||
SaveAccountLinkingTokenRequest(@Param(1) PendingIntent consentPendingIntent, @Param(2) String tokenType, @Param(3) String serviceId, @Param(4) List<String> scopes, @Param(5) String sessionId, @Param(6) int theme) {
|
||||
this.consentPendingIntent = consentPendingIntent;
|
||||
this.tokenType = tokenType;
|
||||
this.serviceId = serviceId;
|
||||
this.scopes = scopes;
|
||||
this.sessionId = sessionId;
|
||||
this.theme = theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of the {@link SaveAccountLinkingTokenRequest.Builder} that can be used to build an instance of {@link SaveAccountLinkingTokenRequest}.
|
||||
*/
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link PendingIntent} that is set in the request and will be used to launch the consent page by Google Play Services during the flow.
|
||||
*/
|
||||
public PendingIntent getConsentPendingIntent() {
|
||||
return consentPendingIntent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the scopes that were set in the request. These are the requested scopes for the token that will be issued by your application.
|
||||
*/
|
||||
public List<String> getScopes() {
|
||||
return scopes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the service-id that was set in the request. This service-id can be found in your cloud project.
|
||||
*/
|
||||
public String getServiceId() {
|
||||
return serviceId;
|
||||
}
|
||||
|
||||
@Hide
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@Hide
|
||||
public int getTheme() {
|
||||
return theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of token that is requested.
|
||||
*/
|
||||
public String getTokenType() {
|
||||
return tokenType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof SaveAccountLinkingTokenRequest)) return false;
|
||||
|
||||
SaveAccountLinkingTokenRequest that = (SaveAccountLinkingTokenRequest) o;
|
||||
|
||||
if (theme != that.theme) return false;
|
||||
if (!Objects.equals(consentPendingIntent, that.consentPendingIntent)) return false;
|
||||
if (!Objects.equals(tokenType, that.tokenType)) return false;
|
||||
if (!Objects.equals(serviceId, that.serviceId)) return false;
|
||||
if (!Objects.equals(scopes, that.scopes)) return false;
|
||||
return Objects.equals(sessionId, that.sessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(new Object[]{consentPendingIntent, tokenType, serviceId, scopes, serviceId, theme});
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for {@link SaveAccountLinkingTokenRequest}.
|
||||
*/
|
||||
public static class Builder {
|
||||
private PendingIntent consentPendingIntent;
|
||||
private String tokenType;
|
||||
private String serviceId;
|
||||
private List<String> scopes;
|
||||
private String sessionId;
|
||||
private int theme;
|
||||
|
||||
/**
|
||||
* Builds an immutable instance of the {@link SaveAccountLinkingTokenRequest}.
|
||||
*/
|
||||
@NonNull
|
||||
public SaveAccountLinkingTokenRequest build() {
|
||||
return new SaveAccountLinkingTokenRequest(consentPendingIntent, tokenType, serviceId, scopes, sessionId, theme);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the (mandatory) {@link PendingIntent} that can be launched by Google Play services to show the consent page during
|
||||
* the flow. When the launched Activity is finished, it has to provide the appropriate data in the result that it returns to the
|
||||
* caller, based on the following contract:
|
||||
* <ul>
|
||||
* <li>
|
||||
* If the user has accepted the consent, the launched Activity must call {@code setResult} with {@link Activity#RESULT_OK}, along with a
|
||||
* token as a (string) intent extra in the result, with the key {@link SaveAccountLinkingTokenRequest#EXTRA_TOKEN},
|
||||
* similar to the following snippet:
|
||||
* <pre>
|
||||
* Intent intent = new Intent();
|
||||
* intent.putExtra(SaveAccountLinkingTokenRequest.EXTRA_TOKEN, token);
|
||||
* setResult(Activity.RESULT_OK, intent);
|
||||
* finish();
|
||||
* </pre>
|
||||
* </li>
|
||||
* <li>
|
||||
* If, however, the user has rejected the consent, the Activity has to call {@code setResult} with {@link Activity#RESULT_CANCELED}.
|
||||
* </li>
|
||||
* </ul>
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setConsentPendingIntent(PendingIntent consentPendingIntent) {
|
||||
this.consentPendingIntent = consentPendingIntent;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list of scopes that are associated with the token that will be saved to Google. Calling this method with the
|
||||
* correct scope(s) is required.
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setScopes(List<String> scopes) {
|
||||
this.scopes = scopes;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the service-id that can be obtained from your Google Cloud project. Calling this method to set {@code serviceId}
|
||||
* is required.
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setServiceId(String serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Hide
|
||||
@NonNull
|
||||
public Builder setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Hide
|
||||
@NonNull
|
||||
public Builder setTheme(int theme) {
|
||||
this.theme = theme;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type of token that will be saved to Google. Valid options are:
|
||||
* <ul>
|
||||
* <li>{@link SaveAccountLinkingTokenRequest#TOKEN_TYPE_AUTH_CODE}</li>
|
||||
* </ul>
|
||||
* Calling this method with a valid token type is required.
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setTokenType(String tokenType) {
|
||||
this.tokenType = tokenType;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<SaveAccountLinkingTokenRequest> CREATOR = findCreator(SaveAccountLinkingTokenRequest.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.os.Parcel;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
import org.microg.gms.common.Hide;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Result returned from the initial call to save an account linking token that includes a {@link PendingIntent} that can be used to
|
||||
* continue the flow.
|
||||
*/
|
||||
@SafeParcelable.Class
|
||||
public class SaveAccountLinkingTokenResult extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "getPendingIntent")
|
||||
private final PendingIntent pendingIntent;
|
||||
|
||||
@Constructor
|
||||
@Hide
|
||||
public SaveAccountLinkingTokenResult(@Param(1) PendingIntent pendingIntent) {
|
||||
this.pendingIntent = pendingIntent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link PendingIntent} that can be used to launch the flow. Note that this method can return a {@code null} value if such
|
||||
* flow cannot be started. It is expected that the caller first calls {@link #hasResolution()} to make sure the flow can be started,
|
||||
* instead of examining the nullness of the result returned by this method.
|
||||
*/
|
||||
public PendingIntent getPendingIntent() {
|
||||
return pendingIntent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if and only if this result contains a resolution that needs to be launched.
|
||||
*/
|
||||
public boolean hasResolution() {
|
||||
return pendingIntent != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof SaveAccountLinkingTokenResult)) return false;
|
||||
|
||||
SaveAccountLinkingTokenResult that = (SaveAccountLinkingTokenResult) o;
|
||||
|
||||
return Objects.equals(pendingIntent, that.pendingIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return pendingIntent != null ? pendingIntent.hashCode() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<SaveAccountLinkingTokenResult> CREATOR = findCreator(SaveAccountLinkingTokenResult.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.os.Parcel;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
import org.microg.gms.common.Hide;
|
||||
|
||||
/**
|
||||
* Configurations that allow saving a {@link SignInPassword} to Google.
|
||||
*/
|
||||
@SafeParcelable.Class
|
||||
public class SavePasswordRequest extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "getSignInPassword")
|
||||
private final SignInPassword signInPassword;
|
||||
@Field(value = 2, getterName = "getSessionId")
|
||||
@Nullable
|
||||
private final String sessionId;
|
||||
@Field(value = 3, getterName = "getTheme")
|
||||
private final int theme;
|
||||
|
||||
@Constructor
|
||||
SavePasswordRequest(@Param(1) SignInPassword signInPassword, @Param(2) @Nullable String sessionId, @Param(3) int theme) {
|
||||
this.signInPassword = signInPassword;
|
||||
this.sessionId = sessionId;
|
||||
this.theme = theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of the {@link SavePasswordRequest.Builder}.
|
||||
*/
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Hide
|
||||
@Nullable
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public SignInPassword getSignInPassword() {
|
||||
return signInPassword;
|
||||
}
|
||||
|
||||
@Hide
|
||||
public int getTheme() {
|
||||
return theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for {@link SavePasswordRequest}.
|
||||
*/
|
||||
public static class Builder {
|
||||
private SignInPassword signInPassword;
|
||||
@Nullable
|
||||
private String sessionId;
|
||||
private int theme;
|
||||
|
||||
/**
|
||||
* Sets the {@link SignInPassword}
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setSignInPassword(@NonNull SignInPassword signInPassword) {
|
||||
this.signInPassword = signInPassword;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Hide
|
||||
@NonNull
|
||||
public Builder setSessionId(@Nullable String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Hide
|
||||
@NonNull
|
||||
public Builder setTheme(int theme) {
|
||||
this.theme = theme;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds and returns a new instance of {@link SavePasswordRequest}.
|
||||
*/
|
||||
@NonNull
|
||||
public SavePasswordRequest build() {
|
||||
return new SavePasswordRequest(signInPassword, sessionId, theme);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<SavePasswordRequest> CREATOR = findCreator(SavePasswordRequest.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.os.Parcel;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* The result returned from calling {@link CredentialSavingClient#savePassword(SavePasswordRequest)} that includes a
|
||||
* {@link PendingIntent} that can be used to launch the password saving flow.
|
||||
*/
|
||||
@SafeParcelable.Class
|
||||
public class SavePasswordResult extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "getPendingIntent")
|
||||
private final PendingIntent pendingIntent;
|
||||
|
||||
@Constructor
|
||||
public SavePasswordResult(@Param(1) PendingIntent pendingIntent) {
|
||||
this.pendingIntent = pendingIntent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link PendingIntent} that should be launched to start the UI flow for saving the password.
|
||||
*/
|
||||
public PendingIntent getPendingIntent() {
|
||||
return pendingIntent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof SavePasswordResult)) return false;
|
||||
|
||||
SavePasswordResult that = (SavePasswordResult) o;
|
||||
|
||||
return Objects.equals(pendingIntent, that.pendingIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return pendingIntent != null ? pendingIntent.hashCode() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<SavePasswordResult> CREATOR = findCreator(SavePasswordResult.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.api.ApiException;
|
||||
import com.google.android.gms.common.api.HasApiKey;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
|
||||
public interface SignInClient extends HasApiKey<SignInOptions> {
|
||||
/**
|
||||
* Initiates the retrieval of a credential that can assist the caller in signing a user in to their application.
|
||||
* <p>
|
||||
* If the request cannot be honored, an exception will be set on the returned {@link Task}. In all other cases, a
|
||||
* {@link BeginSignInResult} will be returned.
|
||||
*
|
||||
* @param signInRequest configuration for the sign-in operation
|
||||
* @return {@link Task} which eventually contains the result of the initialization
|
||||
*/
|
||||
@NonNull
|
||||
Task<BeginSignInResult> beginSignIn(@NonNull BeginSignInRequest signInRequest);
|
||||
|
||||
/**
|
||||
* Retrieves the Phone Number from the {@link Intent} returned upon a successful Phone Number Hint request, throwing an
|
||||
* {@link ApiException} if no phone number is available or the input {@link Intent} is null.
|
||||
*
|
||||
* @throws ApiException
|
||||
*/
|
||||
@NonNull
|
||||
String getPhoneNumberFromIntent(@Nullable Intent data) throws ApiException;
|
||||
|
||||
/**
|
||||
* Gets the {@link PendingIntent} that initiates the Phone Number Hint flow.
|
||||
* <p>
|
||||
* If there is no phone number on the device, an exception will be set on the returned {@link Task}. In all other cases, a
|
||||
* {@link PendingIntent} will be returned.
|
||||
*
|
||||
* @return {@link Task} which can be used to start the Phone Number Hint flow.
|
||||
*/
|
||||
@NonNull
|
||||
Task<PendingIntent> getPhoneNumberHintIntent(@NonNull GetPhoneNumberHintIntentRequest getPhoneNumberHintIntentRequest);
|
||||
|
||||
/**
|
||||
* Retrieves the {@link SignInCredential} from the {@link Intent} returned upon successful sign-in, throwing an {@link ApiException} if no
|
||||
* credential is present.
|
||||
*
|
||||
* @throws ApiException
|
||||
*/
|
||||
@NonNull
|
||||
SignInCredential getSignInCredentialFromIntent(@Nullable Intent data) throws ApiException;
|
||||
|
||||
/**
|
||||
* Gets the {@link PendingIntent} that initiates the Google Sign-in flow.
|
||||
* <p>
|
||||
* If the request cannot be honored, an exception will be set on the returned {@link Task}. In all other cases, a {@link PendingIntent}
|
||||
* will be returned.
|
||||
*
|
||||
* @param getSignInIntentRequest configuration for Google Sign-in flow
|
||||
* @return {@link Task} which eventually contains the {@link PendingIntent} to start the Google Sign-in flow.
|
||||
*/
|
||||
@NonNull
|
||||
Task<PendingIntent> getSignInIntent(@NonNull GetSignInIntentRequest getSignInIntentRequest);
|
||||
|
||||
/**
|
||||
* Resets internal state related to sign-in.
|
||||
* <p>
|
||||
* This method should be invoked when a user signs out of your app.
|
||||
*
|
||||
* @return {@link Task} which eventually terminates in success or failure
|
||||
*/
|
||||
@NonNull
|
||||
Task<Void> signOut();
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
import com.google.android.gms.fido.fido2.api.common.PublicKeyCredential;
|
||||
import org.microg.gms.common.Hide;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* The credential returned as a result of a successful sign-in. Data returned within this object depends on the type of
|
||||
* credential that user has selected; for example a password is returned only when a password-backed credential was
|
||||
* selected.
|
||||
*/
|
||||
@SafeParcelable.Class
|
||||
public class SignInCredential extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "getId")
|
||||
private final String id;
|
||||
@Field(value = 2, getterName = "getDisplayName")
|
||||
private final String displayName;
|
||||
@Field(value = 3, getterName = "getGivenName")
|
||||
private final String givenName;
|
||||
@Field(value = 4, getterName = "getFamilyName")
|
||||
private final String familyName;
|
||||
@Field(value = 5, getterName = "getProfilePictureUri")
|
||||
private final Uri profilePictureUri;
|
||||
@Field(value = 6, getterName = "getPassword")
|
||||
private final String password;
|
||||
@Field(value = 7, getterName = "getGoogleIdToken")
|
||||
private final String googleIdToken;
|
||||
@Field(value = 8, getterName = "getPhoneNumber")
|
||||
private final String phoneNumber;
|
||||
@Field(value = 9, getterName = "getPublicKeyCredential")
|
||||
private final PublicKeyCredential publicKeyCredential;
|
||||
|
||||
@Hide
|
||||
@Constructor
|
||||
public SignInCredential(@Param(1) String id, @Param(2) String displayName, @Param(3) String givenName, @Param(4) String familyName, @Param(5) Uri profilePictureUri, @Param(6) String password, @Param(7) String googleIdToken, @Param(8) String phoneNumber, @Param(9) PublicKeyCredential publicKeyCredential) {
|
||||
this.id = id;
|
||||
this.displayName = displayName;
|
||||
this.givenName = givenName;
|
||||
this.familyName = familyName;
|
||||
this.profilePictureUri = profilePictureUri;
|
||||
this.password = password;
|
||||
this.googleIdToken = googleIdToken;
|
||||
this.phoneNumber = phoneNumber;
|
||||
this.publicKeyCredential = publicKeyCredential;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public String getFamilyName() {
|
||||
return familyName;
|
||||
}
|
||||
|
||||
public String getGivenName() {
|
||||
return givenName;
|
||||
}
|
||||
|
||||
public String getGoogleIdToken() {
|
||||
return googleIdToken;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the identifier of the credential. For an ID token credential, this returns the email address of the user's account
|
||||
* and for a password-backed credential, it returns the username for that password.
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated No replacement.
|
||||
*/
|
||||
@Deprecated
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public Uri getProfilePictureUri() {
|
||||
return profilePictureUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code publicKeyCredential}.
|
||||
*/
|
||||
public PublicKeyCredential getPublicKeyCredential() {
|
||||
return publicKeyCredential;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof SignInCredential)) return false;
|
||||
|
||||
SignInCredential that = (SignInCredential) o;
|
||||
|
||||
if (!Objects.equals(id, that.id)) return false;
|
||||
if (!Objects.equals(displayName, that.displayName)) return false;
|
||||
if (!Objects.equals(givenName, that.givenName)) return false;
|
||||
if (!Objects.equals(familyName, that.familyName)) return false;
|
||||
if (!Objects.equals(profilePictureUri, that.profilePictureUri)) return false;
|
||||
if (!Objects.equals(password, that.password)) return false;
|
||||
if (!Objects.equals(googleIdToken, that.googleIdToken)) return false;
|
||||
if (!Objects.equals(phoneNumber, that.phoneNumber)) return false;
|
||||
return Objects.equals(publicKeyCredential, that.publicKeyCredential);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(new Object[]{id, displayName, givenName, familyName, profilePictureUri, password, googleIdToken, phoneNumber, publicKeyCredential});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<SignInCredential> CREATOR = findCreator(SignInCredential.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.api.Api;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class SignInOptions implements Api.ApiOptions.Optional {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(new Object[]{SignInOptions.class});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
return obj instanceof SignInOptions;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.os.Parcel;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* An account ID such as a username or an email, and a password that can be used to sign a user in.
|
||||
*/
|
||||
@SafeParcelable.Class
|
||||
public class SignInPassword extends AbstractSafeParcelable {
|
||||
@Field(value = 1, getterName = "getId")
|
||||
@NonNull
|
||||
private final String id;
|
||||
@Field(value = 2, getterName = "getPassword")
|
||||
@NonNull
|
||||
private final String password;
|
||||
|
||||
@Constructor
|
||||
public SignInPassword(@Param(1) @NonNull String id, @Param(2) @NonNull String password) {
|
||||
this.id = id;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof SignInPassword)) return false;
|
||||
|
||||
SignInPassword that = (SignInPassword) o;
|
||||
|
||||
if (!id.equals(that.id)) return false;
|
||||
return password.equals(that.password);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(new String[]{id, password});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<SignInPassword> CREATOR = findCreator(SignInPassword.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.common.api.Scope;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SafeParcelable.Class
|
||||
public class VerifyWithGoogleRequest extends AbstractSafeParcelable {
|
||||
|
||||
@Field(1)
|
||||
public List<Scope> requestedScopes;
|
||||
@Field(2)
|
||||
public String serverClientId;
|
||||
@Field(3)
|
||||
public boolean offlineAccess;
|
||||
@Field(4)
|
||||
public String sessionId;
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<VerifyWithGoogleRequest> CREATOR = findCreator(VerifyWithGoogleRequest.class);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VerifyWithGoogleRequest{" +
|
||||
"requestedScopes=" + requestedScopes +
|
||||
", serverClientId='" + serverClientId + '\'' +
|
||||
", offlineAccess=" + offlineAccess +
|
||||
", sessionId='" + sessionId + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.common.api.Scope;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SafeParcelable.Class
|
||||
public class VerifyWithGoogleResult extends AbstractSafeParcelable {
|
||||
|
||||
@Field(1)
|
||||
public String serverAuthToken;
|
||||
@Field(2)
|
||||
public String idToken;
|
||||
@Field(3)
|
||||
public List<Scope> grantedScopes;
|
||||
@Field(4)
|
||||
public PendingIntent pendingIntent;
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<VerifyWithGoogleResult> CREATOR = findCreator(VerifyWithGoogleResult.class);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VerifyWithGoogleResult{" +
|
||||
"serverAuthToken='" + serverAuthToken + '\'' +
|
||||
", idToken='" + idToken + '\'' +
|
||||
", grantedScopes=" + grantedScopes +
|
||||
", pendingIntent=" + pendingIntent +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: CC-BY-4.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides facilities to retrieve or save credentials that can be used to sign the user into your application or sign up a new user.
|
||||
*/
|
||||
package com.google.android.gms.auth.api.identity;
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.signin;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import com.google.android.gms.auth.api.signin.internal.Storage;
|
||||
import com.google.android.gms.common.api.ApiException;
|
||||
import com.google.android.gms.common.api.Scope;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.android.gms.tasks.Tasks;
|
||||
import org.microg.gms.auth.api.signin.GoogleSignInCommon;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Entry point for the Google Sign In API. See GoogleSignInClient.
|
||||
*
|
||||
* @deprecated Use Credential Manager for authentication or Google Identity Services for authorization.
|
||||
*/
|
||||
@Deprecated
|
||||
public class GoogleSignIn {
|
||||
private GoogleSignIn() {
|
||||
// Disallow instantiation
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a {@link GoogleSignInAccount} object to use with other authenticated APIs. Please specify the additional configurations required by the
|
||||
* authenticated API, e.g. {@link com.google.android.gms.fitness.FitnessOptions} indicating what data types you'd like to access.
|
||||
*/
|
||||
@NonNull
|
||||
public static GoogleSignInAccount getAccountForExtension(@NonNull Context context, @NonNull GoogleSignInOptionsExtension extension) {
|
||||
GoogleSignInAccount lastSignedInAccount = getLastSignedInAccount(context);
|
||||
if (lastSignedInAccount == null) lastSignedInAccount = GoogleSignInAccount.createDefault();
|
||||
return lastSignedInAccount.requestExtraScopes(extension.getImpliedScopes().toArray(new Scope[0]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a {@link GoogleSignInAccount} object to use with other authenticated APIs. Please specify the scope(s) required by the authenticated API.
|
||||
*/
|
||||
@NonNull
|
||||
public static GoogleSignInAccount getAccountForScopes(@NonNull Context context, @NonNull Scope scope, @NonNull Scope... scopes) {
|
||||
GoogleSignInAccount lastSignedInAccount = getLastSignedInAccount(context);
|
||||
if (lastSignedInAccount == null) lastSignedInAccount = GoogleSignInAccount.createDefault();
|
||||
lastSignedInAccount.requestExtraScopes(scope);
|
||||
lastSignedInAccount.requestExtraScopes(scopes);
|
||||
return lastSignedInAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of {@link GoogleSignInClient}
|
||||
* <p>
|
||||
* See also {@link #getClient(Activity, GoogleSignInOptions)} for GoogleSignInOptions configuration.
|
||||
*
|
||||
* @param context A Context used to provide information about the application's environment.
|
||||
*/
|
||||
@NonNull
|
||||
public static GoogleSignInClient getClient(@NonNull Context context, @NonNull GoogleSignInOptions options) {
|
||||
return new GoogleSignInClient(context, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of {@link GoogleSignInClient}
|
||||
*
|
||||
* @param activity An {@link Activity} that will be used to manage the lifecycle of the GoogleSignInClient.
|
||||
* @param options A {@link GoogleSignInOptions} used to configure the GoogleSignInClient. It is recommended to build out a GoogleSignInOptions starting
|
||||
* with {@code new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)}, configuring either ID token or Server Auth Code
|
||||
* options if you have a server. Later, in-context incrementally auth to additional scopes for other Google services access.
|
||||
* @return A instance of {@link GoogleSignInClient}
|
||||
*/
|
||||
@NonNull
|
||||
public static GoogleSignInClient getClient(@NonNull Activity activity, @NonNull GoogleSignInOptions options) {
|
||||
return new GoogleSignInClient(activity, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last account that the user signed in with.
|
||||
*
|
||||
* @return {@link GoogleSignInAccount} from last known successful sign-in. If user has never signed in before or has signed out / revoked
|
||||
* access, {@code null} is returned.
|
||||
*/
|
||||
@Nullable
|
||||
public static GoogleSignInAccount getLastSignedInAccount(@NonNull Context context) {
|
||||
return Storage.getInstance(context).getSavedDefaultGoogleSignInAccount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link GoogleSignInAccount} present in the result data for the associated Activity started via
|
||||
* {@link GoogleSignInClient#getSignInIntent()}.
|
||||
*
|
||||
* @param data the {@link Intent} returned via {@link Activity#onActivityResult(int, int, Intent)} when sign in completed.
|
||||
* @return A completed {@link Task} containing a {@link GoogleSignInAccount} object.
|
||||
*/
|
||||
@NonNull
|
||||
public static Task<GoogleSignInAccount> getSignedInAccountFromIntent(@Nullable Intent data) {
|
||||
GoogleSignInResult signInResultFromIntent = GoogleSignInCommon.getSignInResultFromIntent(data);
|
||||
GoogleSignInAccount signInAccount = signInResultFromIntent.getSignInAccount();
|
||||
return (!signInResultFromIntent.isSuccess() || signInAccount == null) ? Tasks.forException(new ApiException(signInResultFromIntent.getStatus())) : Tasks.forResult(signInAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the given account has been granted permission to all scopes associated with the given extension.
|
||||
*
|
||||
* @param account the account to be checked.
|
||||
* @param extension the extension to be checked.
|
||||
* @return {@code true} if the given account has been granted permission to all scopes associated with the given extension.
|
||||
*/
|
||||
public static boolean hasPermissions(@Nullable GoogleSignInAccount account, @NonNull GoogleSignInOptionsExtension extension) {
|
||||
return hasPermissions(account, extension.getImpliedScopes().toArray(new Scope[0]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the given account has been granted permission to all given scopes.
|
||||
*
|
||||
* @param account the account to be checked.
|
||||
* @param scopes the collection of scopes to be checked.
|
||||
* @return {@code true} if the given account has been granted permission to all given scopes.
|
||||
*/
|
||||
public static boolean hasPermissions(@Nullable GoogleSignInAccount account, @NonNull Scope... scopes) {
|
||||
if (account == null) return false;
|
||||
Set<Scope> scopeSet = new HashSet<>();
|
||||
Collections.addAll(scopeSet, scopes);
|
||||
return account.getGrantedScopes().containsAll(scopeSet);
|
||||
}
|
||||
|
||||
private static Intent createRequestPermissionsIntent(@NonNull Activity activity, @Nullable GoogleSignInAccount account, @NonNull Scope... scopes) {
|
||||
GoogleSignInOptions.Builder builder = new GoogleSignInOptions.Builder();
|
||||
if (scopes.length > 0) builder.requestScopes(scopes[0], scopes);
|
||||
if (account != null && account.getEmail() != null && !account.getEmail().isEmpty())
|
||||
builder.setAccountName(account.getEmail());
|
||||
return getClient(activity, builder.build()).getSignInIntent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests a collection of permissions to be granted to the given account. If the account does not have the requested permissions the user
|
||||
* will be presented with a UI for accepting them. Once the user has accepted or rejected a response will returned via
|
||||
* {@link Activity#onActivityResult(int, int, Intent)}.
|
||||
*
|
||||
* @param activity the target activity that will receive the response.
|
||||
* @param requestCode code associated with the request. It will match the {@code requestCode} associated with the response returned via {@link Activity#onActivityResult(int, int, Intent)}.
|
||||
* @param account the account for which the permissions will be requested. If {@code null} the user may have the option to choose.
|
||||
* @param scopes the extra collection of scopes to be requested.
|
||||
*/
|
||||
public static void requestPermissions(@NonNull Activity activity, int requestCode, @Nullable GoogleSignInAccount account, @NonNull Scope... scopes) {
|
||||
activity.startActivityForResult(createRequestPermissionsIntent(activity, account, scopes), requestCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests a collection of permissions associated with the given extension to be granted to the given account. If the account does not have
|
||||
* the requested permissions the user will be presented with a UI for accepting them. Once the user has accepted or rejected a response will
|
||||
* returned via {@link Activity#onActivityResult(int, int, Intent)}.
|
||||
*
|
||||
* @param activity the target activity that will receive the response.
|
||||
* @param requestCode code associated with the request. It will match the {@code requestCode} associated with the response returned via {@link Activity#onActivityResult(int, int, Intent)}.
|
||||
* @param account the account for which the permissions will be requested. If {@code null} the user may have the option to choose.
|
||||
* @param extension the extension associated with a set of permissions to be requested.
|
||||
*/
|
||||
public static void requestPermissions(@NonNull Activity activity, int requestCode, @Nullable GoogleSignInAccount account, @NonNull GoogleSignInOptionsExtension extension) {
|
||||
requestPermissions(activity, requestCode, account, extension.getImpliedScopes().toArray(new Scope[0]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fragment the fragment to launch permission resolution Intent from.
|
||||
*/
|
||||
public static void requestPermissions(@NonNull Fragment fragment, int requestCode, @Nullable GoogleSignInAccount account, @NonNull GoogleSignInOptionsExtension extension) {
|
||||
requestPermissions(fragment, requestCode, account, extension.getImpliedScopes().toArray(new Scope[0]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fragment the fragment to launch permission resolution Intent from.
|
||||
*/
|
||||
public static void requestPermissions(@NonNull Fragment fragment, int requestCode, @Nullable GoogleSignInAccount account, @NonNull Scope... scopes) {
|
||||
fragment.startActivityForResult(createRequestPermissionsIntent(fragment.getActivity(), account, scopes), requestCode);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.signin;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
import com.google.android.gms.common.api.OptionalPendingResult;
|
||||
import com.google.android.gms.common.api.PendingResult;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
|
||||
/**
|
||||
* Api interface for Sign In with Google.
|
||||
*
|
||||
* @deprecated Use Credential Manager for authentication or Google Identity Services for authorization.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface GoogleSignInApi {
|
||||
/**
|
||||
* String {@link Intent} extra key for getting the SignInAccount from the {@link Intent} data returned on {@link Activity#onActivityResult(int, int, Intent)}
|
||||
* when sign-in succeeded.
|
||||
*/
|
||||
@NonNull
|
||||
String EXTRA_SIGN_IN_ACCOUNT = "signInAccount";
|
||||
|
||||
/**
|
||||
* Gets an {@link Intent} to start the Google Sign In flow by calling {@link Activity#startActivityForResult(Intent, int)}.
|
||||
*
|
||||
* @param client The {@link GoogleApiClient} to service the call.
|
||||
* @return the {@link Intent} used for start the sign-in flow.
|
||||
*/
|
||||
@NonNull
|
||||
Intent getSignInIntent(GoogleApiClient client);
|
||||
|
||||
/**
|
||||
* Helper function to extract out {@link GoogleSignInResult} from the {@link Activity#onActivityResult(int, int, Intent)} for Sign In.
|
||||
*
|
||||
* @param data the {@link Intent} returned on {@link Activity#onActivityResult(int, int, Intent)} when sign in completed.
|
||||
* @return The {@link GoogleSignInResult} object. Make sure to pass the {@link Intent} you get back from {@link Activity#onActivityResult(int, int, Intent)
|
||||
* for Sign In, otherwise result will be null.
|
||||
*/
|
||||
@Nullable
|
||||
GoogleSignInResult getSignInResultFromIntent(@NonNull Intent data);
|
||||
|
||||
/**
|
||||
* Revokes access given to the current application. Future sign-in attempts will require the user to re-consent to all requested scopes.
|
||||
* Applications are required to provide users that are signed in with Google the ability to disconnect their Google account from the app. If the
|
||||
* user deletes their account, you must delete the information that your app obtained from the Google APIs.
|
||||
*
|
||||
* @param client The connected {@link GoogleApiClient} to service the call.
|
||||
* @return the PendingResult for notification and access to the result when it's available.
|
||||
*/
|
||||
@NonNull
|
||||
PendingResult<Status> revokeAccess(@NonNull GoogleApiClient client);
|
||||
|
||||
/**
|
||||
* Signs out the current signed-in user if any. It also clears the account previously selected by the user and a future sign in attempt will require
|
||||
* the user pick an account again.
|
||||
*
|
||||
* @param client The connected {@link GoogleApiClient} to service the call.
|
||||
* @return the PendingResult for notification and access to the result when it's available.
|
||||
*/
|
||||
@NonNull
|
||||
PendingResult<Status> signOut(@NonNull GoogleApiClient client);
|
||||
|
||||
/**
|
||||
* Returns the {@link GoogleSignInAccount} information for the user who is signed in to this app. If no user is signed in, try to sign the
|
||||
* user in without displaying any user interface.
|
||||
* <p>
|
||||
* Client activities may call the returned {@link OptionalPendingResult#isDone()} to decide whether to show a loading indicator and set callbacks
|
||||
* to handle an asynchronous result, or directly proceed to the next step.
|
||||
* <p>
|
||||
* The GoogleSignInResult will possibly contain an ID token which may be used to authenticate and identify sessions that you establish with
|
||||
* your application servers. If you use the ID token expiry time to determine your session lifetime, you should retrieve a refreshed ID token, by
|
||||
* calling silentSignIn prior to each API call to your application server.
|
||||
* <p>
|
||||
* Calling silentSignIn can also help you detect user revocation of access to your application on other platforms and you can call
|
||||
* {@link #getSignInIntent(GoogleApiClient)} again to ask the user to re-authorize.
|
||||
* <p>
|
||||
* If your user has never previously signed in to your app on the current device, we can still try to sign them in, without displaying user
|
||||
* interface, if they have signed in on a different device.
|
||||
* <p>
|
||||
* We attempt to sign users in if:
|
||||
* <ul>
|
||||
* <li>There is one and only one matching account on the device that has previously signed in to your application, and</li>
|
||||
* <li>the user previously granted all of the scopes your app is requesting for this sign in.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param client The {@link GoogleApiClient} to service the call.
|
||||
* @return {@link OptionalPendingResult} that will yield a {@link GoogleSignInResult}. Check for an immediate result with
|
||||
* {@link OptionalPendingResult#isDone()}; or set a callback to handle asynchronous results.
|
||||
*/
|
||||
@NonNull
|
||||
OptionalPendingResult<GoogleSignInResult> silentSignIn(@NonNull GoogleApiClient client);
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.signin;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.google.android.gms.auth.api.Auth;
|
||||
import com.google.android.gms.common.api.GoogleApi;
|
||||
import com.google.android.gms.common.internal.PendingResultUtil;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import org.microg.gms.auth.api.signin.GoogleSignInCommon;
|
||||
|
||||
/**
|
||||
* A client for interacting with the Google Sign In API.
|
||||
*
|
||||
* @deprecated Use Credential Manager for authentication or Google Identity Services for authorization.
|
||||
*/
|
||||
@Deprecated
|
||||
public class GoogleSignInClient extends GoogleApi<GoogleSignInOptions> {
|
||||
GoogleSignInClient(@NonNull Context context, GoogleSignInOptions options) {
|
||||
super(context, Auth.GOOGLE_SIGN_IN_API, options);
|
||||
}
|
||||
|
||||
GoogleSignInClient(@NonNull Activity activity, GoogleSignInOptions options) {
|
||||
super(activity, Auth.GOOGLE_SIGN_IN_API, options);
|
||||
}
|
||||
|
||||
private boolean isLocalFallback() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link Intent} to start the Google Sign In flow by calling {@link Activity#startActivityForResult(Intent, int)}.
|
||||
*
|
||||
* @return The {@link Intent} used for start the sign-in flow.
|
||||
*/
|
||||
@NonNull
|
||||
public Intent getSignInIntent() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Revokes access given to the current application. Future sign-in attempts will require the user to re-consent to all requested scopes.
|
||||
* Applications are required to provide users that are signed in with Google the ability to disconnect their Google account from the app. If the
|
||||
* user deletes their account, you must delete the information that your app obtained from the Google APIs.
|
||||
*
|
||||
* @return A {@link Task} that may be used to check for failure, success or completion
|
||||
*/
|
||||
@NonNull
|
||||
public Task<Void> revokeAccess() {
|
||||
return PendingResultUtil.toVoidTask(GoogleSignInCommon.revokeAccess(asGoogleApiClient(), getApplicationContext(), isLocalFallback()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Signs out the current signed-in user if any. It also clears the account previously selected by the user and a future sign in attempt will require
|
||||
* the user pick an account again.
|
||||
*
|
||||
* @return A {@link Task} that may be used to check for failure, success or completion
|
||||
*/
|
||||
@NonNull
|
||||
public Task<Void> signOut() {
|
||||
return PendingResultUtil.toVoidTask(GoogleSignInCommon.signOut(asGoogleApiClient(), getApplicationContext(), isLocalFallback()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link GoogleSignInAccount} information for the user who is signed in to this app. If no user is signed in, try to sign the
|
||||
* user in without displaying any user interface.
|
||||
* <p>
|
||||
* The GoogleSignInAccount will possibly contain an ID token which may be used to authenticate and identify sessions that you establish with
|
||||
* your application servers. If you use the ID token expiry time to determine your session lifetime, you should retrieve a refreshed ID token, by
|
||||
* calling silentSignIn prior to each API call to your application server.
|
||||
* <p>
|
||||
* Calling silentSignIn can also help you detect user revocation of access to your application on other platforms and you can call
|
||||
* {@link #getSignInIntent()} again to ask the user to re-authorize.
|
||||
* <p>
|
||||
* If your user has never previously signed in to your app on the current device, we can still try to sign them in, without displaying user
|
||||
* interface, if they have signed in on a different device.
|
||||
* <p>
|
||||
* We attempt to sign users in if:
|
||||
* <ul>
|
||||
* <li>There is one and only one matching account on the device that has previously signed in to your application, and</li>
|
||||
* <li>the user previously granted all of the scopes your app is requesting for this sign in.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return A {@link Task} that will yield a {@link GoogleSignInAccount}. Check for an immediate result with {@link Task#isSuccessful()}; or set a
|
||||
* callback to handle asynchronous results.
|
||||
*/
|
||||
@NonNull
|
||||
public Task<GoogleSignInAccount> silentSignIn() {
|
||||
return PendingResultUtil.toTask(GoogleSignInCommon.silentSignIn(asGoogleApiClient(), getApplicationContext(), getApiOptions(), isLocalFallback()), (result) -> ((GoogleSignInResult) result).getSignInAccount());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.signin;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.common.api.Result;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import org.microg.gms.common.Hide;
|
||||
|
||||
/**
|
||||
* GoogleSignInResults are {@link Result} implementations that potentially contain a {@link GoogleSignInAccount}.
|
||||
*
|
||||
* @deprecated Use Credential Manager for authentication or Google Identity Services for authorization.
|
||||
*/
|
||||
@Deprecated
|
||||
public class GoogleSignInResult implements Result {
|
||||
@Nullable
|
||||
private final GoogleSignInAccount signInAccount;
|
||||
@NonNull
|
||||
private final Status status;
|
||||
|
||||
@Hide
|
||||
public GoogleSignInResult(@Nullable GoogleSignInAccount signInAccount, @NonNull Status status) {
|
||||
this.signInAccount = signInAccount;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link GoogleSignInAccount} reflecting the user's sign in information if sign-in completed successfully; or {@code null} when failed.
|
||||
*/
|
||||
@Nullable
|
||||
public GoogleSignInAccount getSignInAccount() {
|
||||
return signInAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Status} object indicating the status of the sign in attempt.
|
||||
* <p>
|
||||
* You can use {@link #isSuccess()} to determine quickly if sign-in succeeded. If sign-in failed, you can match the status code retrieved from
|
||||
* {@link Status#getStatusCode()} to consts defined in {@link GoogleSignInStatusCodes} and its parent class.
|
||||
*/
|
||||
@NonNull
|
||||
@Override
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient method to help you tell if sign-in completed successfully.
|
||||
*/
|
||||
public boolean isSuccess() {
|
||||
return status.isSuccess();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.signin;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import com.google.android.gms.common.api.CommonStatusCodes;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
|
||||
/**
|
||||
* Google Sign In specific status codes, for use in {@link Status#getStatusCode()}.
|
||||
* <p>
|
||||
* In addition to codes defined in this class, you might also want to check:
|
||||
* <ul>
|
||||
* <li>{@link CommonStatusCodes#SIGN_IN_REQUIRED}</li>
|
||||
* <li>{@link CommonStatusCodes#NETWORK_ERROR}</li>
|
||||
* <li>{@link CommonStatusCodes#INVALID_ACCOUNT}</li>
|
||||
* <li>{@link CommonStatusCodes#INTERNAL_ERROR}</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Deprecated
|
||||
public class GoogleSignInStatusCodes extends CommonStatusCodes {
|
||||
private GoogleSignInStatusCodes() {
|
||||
// Disallow instantiation
|
||||
}
|
||||
|
||||
/**
|
||||
* The sign in attempt didn't succeed with the current account.
|
||||
* <p>
|
||||
* Unlike {@link CommonStatusCodes#SIGN_IN_REQUIRED}. when seeing this error code, there is nothing user can do to recover from the sign in
|
||||
* failure. Switching to another account may or may not help. Check adb log to see details if any.
|
||||
*/
|
||||
public static final int SIGN_IN_FAILED = 12500;
|
||||
/**
|
||||
* The sign in was cancelled by the user. i.e. user cancelled some of the sign in resolutions, e.g. account picking or OAuth consent.
|
||||
*/
|
||||
public static final int SIGN_IN_CANCELLED = 12501;
|
||||
/**
|
||||
* A sign in process is currently in progress and the current one cannot continue. e.g. the user clicks the SignInButton multiple times and more
|
||||
* than one sign in intent was launched.
|
||||
*/
|
||||
public static final int SIGN_IN_CURRENTLY_IN_PROGRESS = 12502;
|
||||
|
||||
/**
|
||||
* Returns an untranslated debug (not user-friendly) string based on the current status code.
|
||||
*/
|
||||
@NonNull
|
||||
public static String getStatusCodeString(int statusCode) {
|
||||
switch (statusCode) {
|
||||
case SIGN_IN_FAILED:
|
||||
return "A non-recoverable sign in failure occurred";
|
||||
case SIGN_IN_CANCELLED:
|
||||
return "Sign in action cancelled";
|
||||
case SIGN_IN_CURRENTLY_IN_PROGRESS:
|
||||
return "Sign-in in progress";
|
||||
default:
|
||||
return CommonStatusCodes.getStatusCodeString(statusCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.signin;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import org.microg.gms.common.Hide;
|
||||
import org.microg.gms.utils.ToStringHelper;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
@Hide
|
||||
public class SignInAccount extends AutoSafeParcelable {
|
||||
@Field(4)
|
||||
public String email;
|
||||
@Field(7)
|
||||
public GoogleSignInAccount googleSignInAccount;
|
||||
@Field(8)
|
||||
public String userId;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringHelper.name("SignInAccount").field("email", email).field("account", googleSignInAccount).field("userId", userId).end();
|
||||
}
|
||||
|
||||
public static final Creator<SignInAccount> CREATOR = findCreator(SignInAccount.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.auth.api.signin.internal;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
|
||||
import org.microg.gms.common.Hide;
|
||||
import org.microg.gms.utils.ToStringHelper;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Hide
|
||||
@SafeParcelable.Class
|
||||
public class SignInConfiguration extends AbstractSafeParcelable {
|
||||
@Field(value = 2, getterName = "getPackageName")
|
||||
@NonNull
|
||||
private final String packageName;
|
||||
@Field(value = 5, getterName = "getOptions")
|
||||
@NonNull
|
||||
private final GoogleSignInOptions options;
|
||||
|
||||
@Constructor
|
||||
public SignInConfiguration(@Param(2) @NonNull String packageName, @Param(5) @NonNull GoogleSignInOptions options) {
|
||||
this.packageName = packageName;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public GoogleSignInOptions getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
if (!(o instanceof SignInConfiguration)) return false;
|
||||
|
||||
SignInConfiguration that = (SignInConfiguration) o;
|
||||
return packageName.equals(that.packageName) && Objects.equals(options, that.options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = packageName.hashCode() + 31;
|
||||
hash = Objects.hashCode(options) + (hash * 31);;
|
||||
return hash;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringHelper.name("SignInConfiguration").field("packageName", packageName).field("options", options).end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<SignInConfiguration> CREATOR = findCreator(SignInConfiguration.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: CC-BY-4.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
/**
|
||||
* Contains classes for authenticating Google accounts.
|
||||
*/
|
||||
package com.google.android.gms.auth;
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.microg.gms.auth.api.signin;
|
||||
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.auth.api.Auth;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInApi;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
import com.google.android.gms.common.api.OptionalPendingResult;
|
||||
import com.google.android.gms.common.api.PendingResult;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
|
||||
public class GoogleSignInApiImpl implements GoogleSignInApi {
|
||||
@NonNull
|
||||
@Override
|
||||
public Intent getSignInIntent(GoogleApiClient client) {
|
||||
throw new UnsupportedOperationException();
|
||||
//return GoogleSignInCommon.getSignInIntent(client.getContext(), client.getClient(Auth.GOOGLE_SIGN_IN_API_CLIENT_KEY).getOptions());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public GoogleSignInResult getSignInResultFromIntent(@NonNull Intent data) {
|
||||
return GoogleSignInCommon.getSignInResultFromIntent(data);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public PendingResult<Status> revokeAccess(@NonNull GoogleApiClient client) {
|
||||
return GoogleSignInCommon.revokeAccess(client, client.getContext(), false);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public PendingResult<Status> signOut(@NonNull GoogleApiClient client) {
|
||||
return GoogleSignInCommon.signOut(client, client.getContext(), false);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public OptionalPendingResult<GoogleSignInResult> silentSignIn(@NonNull GoogleApiClient client) {
|
||||
throw new UnsupportedOperationException();
|
||||
//return GoogleSignInCommon.silentSignIn(client, client.getContext(), client.getClient(Auth.GOOGLE_SIGN_IN_API_CLIENT_KEY).getOptions());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.microg.gms.auth.api.signin;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
|
||||
import com.google.android.gms.auth.api.signin.internal.SignInConfiguration;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
import com.google.android.gms.common.api.OptionalPendingResult;
|
||||
import com.google.android.gms.common.api.PendingResult;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
|
||||
public class GoogleSignInCommon {
|
||||
|
||||
@NonNull
|
||||
public static Intent getSignInIntent(Context context, GoogleSignInOptions options) {
|
||||
SignInConfiguration configuration = new SignInConfiguration(context.getPackageName(), options);
|
||||
Bundle configurationBundle = new Bundle();
|
||||
configurationBundle.putParcelable("config", configuration);
|
||||
Intent intent = new Intent("com.google.android.gms.auth.GOOGLE_SIGN_IN");
|
||||
intent.setPackage(context.getPackageName());
|
||||
//intent.setClass(context, GoogleSignInHub.class);
|
||||
intent.putExtra("config", configurationBundle);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static GoogleSignInResult getSignInResultFromIntent(@Nullable Intent data) {
|
||||
if (data == null) return new GoogleSignInResult(null, Status.INTERNAL_ERROR);
|
||||
Status status = data.getParcelableExtra("googleSignInStatus");
|
||||
GoogleSignInAccount account = data.getParcelableExtra("googleSignInAccount");
|
||||
if (account != null) return new GoogleSignInResult(account, Status.SUCCESS);
|
||||
if (status == null) status = Status.INTERNAL_ERROR;
|
||||
return new GoogleSignInResult(null, status);
|
||||
}
|
||||
|
||||
public static PendingResult<Status> revokeAccess(GoogleApiClient client, Context context, boolean isLocalFallback) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public static PendingResult<Status> signOut(GoogleApiClient client, Context context, boolean isLocalFallback) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public static OptionalPendingResult<GoogleSignInResult> silentSignIn(GoogleApiClient client, Context context, GoogleSignInOptions options, boolean isLocalFallback) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.microg.gms.auth.api.signin;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.IBinder;
|
||||
import com.google.android.gms.auth.api.signin.internal.ISignInService;
|
||||
import org.microg.gms.common.GmsClient;
|
||||
import org.microg.gms.common.GmsService;
|
||||
import com.google.android.gms.common.api.internal.ConnectionCallbacks;
|
||||
import com.google.android.gms.common.api.internal.OnConnectionFailedListener;
|
||||
|
||||
public class GoogleSignInGmsClientImpl extends GmsClient<ISignInService> {
|
||||
public GoogleSignInGmsClientImpl(Context context, ConnectionCallbacks callbacks, OnConnectionFailedListener connectionFailedListener) {
|
||||
super(context, callbacks, connectionFailedListener, GmsService.AUTH_SIGN_IN.ACTION);
|
||||
serviceId = GmsService.AUTH_SIGN_IN.SERVICE_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ISignInService interfaceFromBinder(IBinder binder) {
|
||||
return ISignInService.Stub.asInterface(binder);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue