CredentialOption.Builder


public static final class CredentialOption.Builder
extends Object

java.lang.Object
   ↳ android.credentials.CredentialOption.Builder


A builder for CredentialOption.

Summary

Public constructors

Builder(String type, Bundle credentialRetrievalData, Bundle candidateQueryData)

Public methods

CredentialOption.Builder addAllowedProvider(ComponentName allowedProvider)

Adds a provider ComponentName to be queried while gathering credentials from credential providers on the device.

CredentialOption build()

Builds a CredentialOption.

CredentialOption.Builder setAllowedProviders(Set<ComponentName> allowedProviders)

Sets a set of provider ComponentName to be queried while gathering credentials from credential providers on the device.

CredentialOption.Builder setIsSystemProviderRequired(boolean isSystemProviderRequired)

Sets a true/false value corresponding to whether this option must be serviced by system credentials providers only.

Inherited methods

Public constructors

Builder

Added in API level 34
public Builder (String type, 
                Bundle credentialRetrievalData, 
                Bundle candidateQueryData)

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

credentialRetrievalData Bundle: the full 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.

Throws
IllegalArgumentException If type is null, or empty
NullPointerException If credentialRetrievalData, or candidateQueryData is null

Public methods

addAllowedProvider

Added in API level 34
public CredentialOption.Builder addAllowedProvider (ComponentName allowedProvider)

Adds a provider ComponentName to be queried while gathering credentials from credential providers on the device. If no candidate providers are specified, all user configured and system credential providers will be queried in the candidate query phase. If an invalid component name is provided, or a service corresponding to the component name does not exist on the device, that component name is ignored. If all component names are invalid, or not present on the device, no providers are queried and no credentials are retrieved.

Parameters
allowedProvider ComponentName: This value cannot be null.

Returns
CredentialOption.Builder This value cannot be null.

Throws
NullPointerException If allowedProvider is null

build

Added in API level 34
public CredentialOption build ()

Builds a CredentialOption.

Returns
CredentialOption This value cannot be null.

setAllowedProviders

Added in API level 34
public CredentialOption.Builder setAllowedProviders (Set<ComponentName> allowedProviders)

Sets a set of provider ComponentName to be queried while gathering credentials from credential providers on the device. If no candidate providers are specified, all user configured and system credential providers will be queried in the candidate query phase. If an invalid component name is provided, or a service corresponding to the component name does not exist on the device, that component name is ignored. If all component names are invalid, or not present on the device, no providers are queried and no credentials are retrieved.

Parameters
allowedProviders Set: This value cannot be null.

Returns
CredentialOption.Builder This value cannot be null.

Throws
NullPointerException If allowedProviders is null, or any of its elements are null.

setIsSystemProviderRequired

Added in API level 34
public CredentialOption.Builder setIsSystemProviderRequired (boolean isSystemProviderRequired)

Sets a true/false value corresponding to whether this option must be serviced by system credentials providers only.

Parameters
isSystemProviderRequired boolean

Returns
CredentialOption.Builder This value cannot be null.