Stay organized with collections Save and categorize content based on your preferences.

CredentialOption

public final class CredentialOption
extends Object implements Parcelable

java.lang.Object
   ↳ android.credentials.CredentialOption


Information about a specific type of credential to be requested during a CredentialManager.getCredential(android.credentials.GetCredentialRequest, Activity, CancellationSignal, Executor, OutcomeReceiver) operation.

Summary

Constants

String FLATTENED_REQUEST

Bundle key to the flattened version of the JSON request string.

Inherited constants

Fields

public static final Creator<CredentialOption> CREATOR

Public constructors

CredentialOption(String type, Bundle credentialRetrievalData, Bundle candidateQueryData, boolean isSystemProviderRequired)

Constructs a CredentialOption.

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

Bundle getCandidateQueryData()

Returns the partial request data that will be sent to the provider during the initial credential candidate query stage.

Bundle getCredentialRetrievalData()

Returns the full request data.

String getType()

Returns the requested credential type.

boolean isSystemProviderRequired()

Returns true if the request must only be fulfilled by a system provider, and false otherwise.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

FLATTENED_REQUEST

public static final String FLATTENED_REQUEST

Bundle key to the flattened version of the JSON request string. Framework will use this key to determine which types of Credentials will utilize Credential Registry when filtering Credential Providers to ping.

Constant Value: "android.credentials.GetCredentialOption.FLATTENED_REQUEST_STRING"

Fields

CREATOR

public static final Creator<CredentialOption> CREATOR

Public constructors

CredentialOption

public CredentialOption (String type, 
                Bundle credentialRetrievalData, 
                Bundle candidateQueryData, 
                boolean isSystemProviderRequired)

Constructs a CredentialOption.

Parameters
type String: the requested credential type This value cannot be null.

credentialRetrievalData Bundle: the request data This value cannot be null.

candidateQueryData Bundle: the partial request data that will be sent to the provider during the initial credential candidate query stage This value cannot be null.

isSystemProviderRequired boolean: whether the request must only be fulfilled by a system provider

Throws
IllegalArgumentException If type is empty.

Public methods

describeContents

public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

getCandidateQueryData

public Bundle getCandidateQueryData ()

Returns the partial request data that will be sent to the provider during the initial credential candidate query stage. For security reason, a provider will receive the request data in two stages. First it gets this partial request that do not contain sensitive user information; it uses this information to provide credential candidates that the [@code CredentialManager] will show to the user. Next, the full request data, getCredentialRetrievalData(), will be sent to a provider only if the user further grants the consent by choosing a candidate from the provider.

Returns
Bundle This value cannot be null.

getCredentialRetrievalData

public Bundle getCredentialRetrievalData ()

Returns the full request data.

Returns
Bundle This value cannot be null.

getType

public String getType ()

Returns the requested credential type.

Returns
String This value cannot be null.

isSystemProviderRequired

public boolean isSystemProviderRequired ()

Returns true if the request must only be fulfilled by a system provider, and false otherwise.

Returns
boolean

toString

public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

writeToParcel

public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES