Add some new (incomplete) classes for Auth API

This commit is contained in:
Marvin W 2016-02-22 23:28:21 +01:00
parent 18582ce01a
commit 2aec42fb75
9 changed files with 297 additions and 1 deletions

View File

@ -0,0 +1,46 @@
/*
* Copyright 2013-2016 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.firstparty.dataservice;
import android.accounts.Account;
import org.microg.gms.auth.AuthConstants;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class AccountRecoveryGuidanceRequest extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
@Deprecated
public final String accountName;
@SafeParceled(3)
public final Account account;
public AccountRecoveryGuidanceRequest(String accountName) {
this.accountName = accountName;
this.account = new Account(accountName, AuthConstants.DEFAULT_ACCOUNT_TYPE);
}
public AccountRecoveryGuidanceRequest(Account account) {
this.accountName = account.name;
this.account = account;
}
public static final Creator<AccountRecoveryGuidanceRequest> CREATOR = new AutoCreator<AccountRecoveryGuidanceRequest>(AccountRecoveryGuidanceRequest.class);
}

View File

@ -0,0 +1,46 @@
/*
* Copyright 2013-2016 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.firstparty.dataservice;
import android.accounts.Account;
import org.microg.gms.auth.AuthConstants;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class AccountRemovalRequest extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
@Deprecated
public final String accountName;
@SafeParceled(3)
public final Account account;
public AccountRemovalRequest(String accountName) {
this.accountName = accountName;
this.account = new Account(accountName, AuthConstants.DEFAULT_ACCOUNT_TYPE);
}
public AccountRemovalRequest(Account account) {
this.accountName = account.name;
this.account = account;
}
public static final Creator<AccountRemovalRequest> CREATOR = new AutoCreator<AccountRemovalRequest>(AccountRemovalRequest.class);
}

View File

@ -0,0 +1,34 @@
/*
* Copyright 2013-2016 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.firstparty.dataservice;
import com.google.android.gms.auth.firstparty.shared.AccountCredentials;
import com.google.android.gms.auth.firstparty.shared.CaptchaSolution;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class ConfirmCredentialsRequest extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public AccountCredentials accountCredentials;
@SafeParceled(3)
public CaptchaSolution captchaSolution;
public static final Creator<ConfirmCredentialsRequest> CREATOR = new AutoCreator<ConfirmCredentialsRequest>(ConfirmCredentialsRequest.class);
}

View File

@ -16,5 +16,29 @@
package com.google.android.gms.auth.firstparty.dataservice; package com.google.android.gms.auth.firstparty.dataservice;
public class TokenRequest { import android.accounts.Account;
import android.os.Bundle;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
// TODO
public class TokenRequest extends AutoSafeParcelable{
@SafeParceled(1)
private int versionCode = 4;
@SafeParceled(3)
public String accountName;
@SafeParceled(4)
public Bundle extras;
@SafeParceled(9)
public String consent;
@SafeParceled(15)
public String accountType;
public Account getAccount() {
return new Account(accountName, accountType);
}
public static final Creator<TokenRequest> CREATOR = new AutoCreator<TokenRequest>(TokenRequest.class);
} }

View File

@ -0,0 +1,43 @@
/*
* Copyright 2013-2016 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.firstparty.delegate;
import android.accounts.Account;
import android.accounts.AccountAuthenticatorResponse;
import android.os.Bundle;
import com.google.android.gms.auth.firstparty.shared.AppDescription;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class ConfirmCredentialsWorkflowRequest extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 3;
@SafeParceled(2)
public String accountName;
@SafeParceled(3)
public AppDescription appDescription;
@SafeParceled(4)
public Bundle extras;
@SafeParceled(5)
public Account account;
@SafeParceled(6)
public AccountAuthenticatorResponse accountAuthenticatorResponse;
public static final Creator<ConfirmCredentialsWorkflowRequest> CREATOR = new AutoCreator<ConfirmCredentialsWorkflowRequest>(ConfirmCredentialsWorkflowRequest.class);
}

View File

@ -0,0 +1,38 @@
/*
* Copyright 2013-2016 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.firstparty.shared;
import android.accounts.Account;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
// TODO
public class AccountCredentials extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 2;
@SafeParceled(3)
public String accountName;
@SafeParceled(9)
public String accountType;
public Account getAccount() {
return new Account(accountName, accountType);
}
public static final Creator<AccountCredentials> CREATOR = new AutoCreator<AccountCredentials>(AccountCredentials.class);
}

View File

@ -0,0 +1,35 @@
/*
* Copyright 2013-2016 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.firstparty.shared;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class AppDescription extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public int callingUid;
@SafeParceled(3)
public String sessiondId;
@SafeParceled(4)
public String sessiondSig;
@SafeParceled(5)
public String callingPkg;
public static final Creator<AppDescription> CREATOR = new AutoCreator<AppDescription>(AppDescription.class);
}

View File

@ -0,0 +1,29 @@
/*
* Copyright 2013-2016 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.firstparty.shared;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
// TODO
public class CaptchaSolution extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
public static final Creator<CaptchaSolution> CREATOR = new AutoCreator<CaptchaSolution>(CaptchaSolution.class);
}

View File

@ -23,4 +23,5 @@ public class AuthConstants {
public static final String PROVIDER_METHOD_CLEAR_PASSWORD = "clear_password"; public static final String PROVIDER_METHOD_CLEAR_PASSWORD = "clear_password";
public static final String PROVIDER_EXTRA_CLEAR_PASSWORD = "clear_password"; public static final String PROVIDER_EXTRA_CLEAR_PASSWORD = "clear_password";
public static final String PROVIDER_EXTRA_ACCOUNTS = "accounts"; public static final String PROVIDER_EXTRA_ACCOUNTS = "accounts";
public static final String DEFAULT_ACCOUNT_TYPE = "com.google";
} }