Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder class for AppUriAuthenticationPolicy
objects.
Summary
Public constructors
Public methods
addAppAndUriMapping
fun addAppAndUriMapping(
appPackageName: String,
uri: Uri,
alias: String
): AppUriAuthenticationPolicy.Builder
Adds mappings from an app and URI to an alias, which will be used for authentication.
If this method is called with a package name and URI that was previously added, the previous alias will be overwritten.
When the system tries to determine which alias to return to a requesting app calling KeyChain.choosePrivateKeyAlias
, it will choose the alias whose associated URI exactly matches the URI provided in KeyChain.choosePrivateKeyAlias(
or the URI built from the host and port provided in KeyChain.choosePrivateKeyAlias(
.
Parameters |
appPackageName |
String: The app's package name to authenticate the user to. This value cannot be null . |
uri |
Uri: The URI to authenticate the user to. This value cannot be null . |
alias |
String: The alias which will be used for authentication. This value cannot be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# AppUriAuthenticationPolicy.Builder\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/security/AppUriAuthenticationPolicy.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|----------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.security.AppUriAuthenticationPolicy.Builder](#) |\n\nBuilder class for [AppUriAuthenticationPolicy](/reference/kotlin/android/security/AppUriAuthenticationPolicy) objects.\n\nSummary\n-------\n\n| Public constructors ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Builder](#Builder())`()` Initialize a new Builder to construct an [AppUriAuthenticationPolicy](/reference/kotlin/android/security/AppUriAuthenticationPolicy). |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [AppUriAuthenticationPolicy.Builder](#) | [addAppAndUriMapping](#addAppAndUriMapping(kotlin.String,%20android.net.Uri,%20kotlin.String))`(`appPackageName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `uri:` `[Uri](../net/Uri.html#)`, `alias:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Adds mappings from an app and URI to an alias, which will be used for authentication. |\n| [AppUriAuthenticationPolicy](/reference/kotlin/android/security/AppUriAuthenticationPolicy) | [build](#build())`()` Combines all of the attributes that have been set on the [Builder](#) |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder()\n```\n\nInitialize a new Builder to construct an [AppUriAuthenticationPolicy](/reference/kotlin/android/security/AppUriAuthenticationPolicy).\n\nPublic methods\n--------------\n\n### addAppAndUriMapping\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun addAppAndUriMapping(\n appPackageName: String, \n uri: Uri, \n alias: String\n): AppUriAuthenticationPolicy.Builder\n```\n\nAdds mappings from an app and URI to an alias, which will be used for authentication.\n\nIf this method is called with a package name and URI that was previously added, the previous alias will be overwritten.\n\nWhen the system tries to determine which alias to return to a requesting app calling `KeyChain.choosePrivateKeyAlias`, it will choose the alias whose associated URI exactly matches the URI provided in [KeyChain.choosePrivateKeyAlias(](/reference/kotlin/android/security/KeyChain#choosePrivateKeyAlias(android.app.Activity,%20android.security.KeyChainAliasCallback,%20kotlin.Array,%20kotlin.Array,%20android.net.Uri,%20kotlin.String)) or the URI built from the host and port provided in [KeyChain.choosePrivateKeyAlias(](/reference/kotlin/android/security/KeyChain#choosePrivateKeyAlias(android.app.Activity,%20android.security.KeyChainAliasCallback,%20kotlin.Array,%20kotlin.Array,%20kotlin.String,%20kotlin.Int,%20kotlin.String)).\n\n| Parameters ||\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `appPackageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The app's package name to authenticate the user to. This value cannot be `null`. |\n| `uri` | [Uri](../net/Uri.html#): The URI to authenticate the user to. This value cannot be `null`. |\n| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The alias which will be used for authentication. This value cannot be `null`. |\n\n| Return ||\n|-----------------------------------------|---------------------------------------------------------|\n| [AppUriAuthenticationPolicy.Builder](#) | the same Builder instance. This value cannot be `null`. |\n\n### build\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): AppUriAuthenticationPolicy\n```\n\nCombines all of the attributes that have been set on the [Builder](#)\n\n| Return ||\n|---------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|\n| [AppUriAuthenticationPolicy](/reference/kotlin/android/security/AppUriAuthenticationPolicy) | a new [AppUriAuthenticationPolicy](/reference/kotlin/android/security/AppUriAuthenticationPolicy) object. This value cannot be `null`. |"]]