Skip to content

Commit

Permalink
Add identity sign-in service (#2130)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaVinci9196 authored Jan 4, 2024
1 parent 3a8cdce commit 048a6e5
Show file tree
Hide file tree
Showing 22 changed files with 472 additions and 10 deletions.
2 changes: 2 additions & 0 deletions play-services-auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ dependencies {
api project(':play-services-basement')
api project(':play-services-fido')
api project(':play-services-tasks')

annotationProcessor project(':safe-parcel-processor')
}
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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);
}
Original file line number Diff line number Diff line change
@@ -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);
}
Original file line number Diff line number Diff line change
@@ -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);
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* SPDX-FileCopyrightText: 2023 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.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;

@SafeParcelable.Class
public class BeginSignInRequest extends AbstractSafeParcelable {
@Field(1)
public PasswordRequestOptions passwordRequestOptions;
@Field(2)
public GoogleIdTokenRequestOptions googleIdTokenRequestOptions;
@Field(3)
public String score;
@Field(4)
public boolean isPrimary;
@Field(5)
public int code;

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
CREATOR.writeToParcel(this, dest, flags);
}

public static final SafeParcelableCreatorAndWriter<BeginSignInRequest> CREATOR = findCreator(BeginSignInRequest.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* SPDX-FileCopyrightText: 2023 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.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;

@SafeParcelable.Class
public class BeginSignInResult extends AbstractSafeParcelable {
@Field(1)
public PendingIntent pendingIntent;

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
CREATOR.writeToParcel(this, dest, flags);
}

public static final SafeParcelableCreatorAndWriter<BeginSignInResult> CREATOR = findCreator(BeginSignInResult.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* SPDX-FileCopyrightText: 2023 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.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;

@SafeParcelable.Class
public class GetPhoneNumberHintIntentRequest extends AbstractSafeParcelable {
@Field(1)
public int code;

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
CREATOR.writeToParcel(this, dest, flags);
}

public static final SafeParcelableCreatorAndWriter<GetPhoneNumberHintIntentRequest> CREATOR = findCreator(GetPhoneNumberHintIntentRequest.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* SPDX-FileCopyrightText: 2023 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.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;

@SafeParcelable.Class
public class GetSignInIntentRequest extends AbstractSafeParcelable {
@Field(1)
public String clientId;
@Field(2)
public String scope;
@Field(3)
public String requestTag;
@Field(4)
public String requestToken;
@Field(5)
public boolean isPrimary;
@Field(6)
public int code;

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
CREATOR.writeToParcel(this, dest, flags);
}

public static final SafeParcelableCreatorAndWriter<GetSignInIntentRequest> CREATOR = findCreator(GetSignInIntentRequest.class);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* SPDX-FileCopyrightText: 2023 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.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;

import java.util.ArrayList;

@SafeParcelable.Class
public class GoogleIdTokenRequestOptions extends AbstractSafeParcelable {
@Field(1)
public boolean idTokenRequested;
@Field(2)
public String clientId;
@Field(3)
public String requestToken;
@Field(4)
public boolean serverAuthCodeRequested;
@Field(5)
public String serverClientId;
@Field(6)
public ArrayList<String> scopes;
@Field(7)
public boolean forceCodeForRefreshToken;

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
CREATOR.writeToParcel(this, dest, flags);
}

public static final SafeParcelableCreatorAndWriter<GoogleIdTokenRequestOptions> CREATOR = findCreator(GoogleIdTokenRequestOptions.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* SPDX-FileCopyrightText: 2023 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.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;

@SafeParcelable.Class
public class PasswordRequestOptions extends AbstractSafeParcelable {
@Field(1)
public boolean primary;

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
CREATOR.writeToParcel(this, dest, flags);
}

public static final SafeParcelableCreatorAndWriter<PasswordRequestOptions> CREATOR = findCreator(PasswordRequestOptions.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* SPDX-FileCopyrightText: 2023 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.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;

@SafeParcelable.Class
public class SignInCredential extends AbstractSafeParcelable {
@Field(1)
public String email;
@Field(2)
public String displayName;
@Field(3)
public String familyName;
@Field(4)
public String givenName;
@Field(5)
public String avatar;
@Field(6)
public String serverAuthCode;
@Field(7)
public String idToken;
@Field(8)
public String obfuscatedIdentifier;

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
CREATOR.writeToParcel(this, dest, flags);
}

public static final SafeParcelableCreatorAndWriter<SignInCredential> CREATOR = findCreator(SignInCredential.class);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ public static <T extends AbstractSafeParcelable> SafeParcelableCreatorAndWriter<
public int describeContents() {
return 0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ public class AuthConstants {
public static final String PROVIDER_EXTRA_CLEAR_PASSWORD = "clear_password";
public static final String PROVIDER_EXTRA_ACCOUNTS = "accounts";
public static final String DEFAULT_ACCOUNT_TYPE = "com.google";
public static final String GOOGLE_USER_ID = "GoogleUserId";
public static final String GOOGLE_SIGN_IN_STATUS = "googleSignInStatus";
public static final String GOOGLE_SIGN_IN_ACCOUNT = "googleSignInAccount";
public static final String SIGN_IN_ACCOUNT = "signInAccount";
public static final String ERROR_CODE = "errorCode";
public static final String SIGN_IN_CREDENTIAL = "sign_in_credential";
public static final String STATUS = "status";

}
Loading

0 comments on commit 048a6e5

Please sign in to comment.