public class BrowserDescriptor
extends java.lang.Object
Represents a browser that may be used for an authorization flow.
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
packageName
The package name of the browser app.
|
java.util.Set<java.lang.String> |
signatureHashes
The set of
signatures of the browser app,
which have been hashed with SHA-512, and Base-64 URL-safe encoded. |
java.lang.Boolean |
useCustomTab
Whether it is intended that the browser will be used via a custom tab.
|
java.lang.String |
version
The version string of the browser app.
|
| Constructor and Description |
|---|
BrowserDescriptor(android.content.pm.PackageInfo packageInfo,
boolean useCustomTab)
Creates a description of a browser from a
PackageInfo object returned from the
PackageManager. |
BrowserDescriptor(java.lang.String packageName,
java.util.Set<java.lang.String> signatureHashes,
java.lang.String version,
boolean useCustomTab)
Creates a description of a browser from the core properties that are frequently used to
decide whether a browser can be used for an authorization flow.
|
| Modifier and Type | Method and Description |
|---|---|
BrowserDescriptor |
changeUseCustomTab(boolean newUseCustomTabValue)
Creates a copy of this browser descriptor, changing the intention to use it as a custom
tab to the specified value.
|
boolean |
equals(java.lang.Object obj) |
static java.lang.String |
generateSignatureHash(android.content.pm.Signature signature)
Generates a SHA-512 hash, Base64 url-safe encoded, from a
Signature. |
static java.util.Set<java.lang.String> |
generateSignatureHashes(android.content.pm.Signature[] signatures)
Generates a set of SHA-512, Base64 url-safe encoded signature hashes from the provided
array of signatures.
|
int |
hashCode() |
public final java.lang.String packageName
The package name of the browser app.
public final java.util.Set<java.lang.String> signatureHashes
The set of signatures of the browser app,
which have been hashed with SHA-512, and Base-64 URL-safe encoded.
public final java.lang.String version
The version string of the browser app.
public final java.lang.Boolean useCustomTab
Whether it is intended that the browser will be used via a custom tab.
public BrowserDescriptor(@NonNull
android.content.pm.PackageInfo packageInfo,
boolean useCustomTab)
Creates a description of a browser from a PackageInfo object returned from the
PackageManager. The object is expected to include the
signatures of the app, which can be retrieved with the
GET_SIGNATURES flag when
calling PackageManager.getPackageInfo(String, int).
public BrowserDescriptor(@NonNull
java.lang.String packageName,
@NonNull
java.util.Set<java.lang.String> signatureHashes,
@NonNull
java.lang.String version,
boolean useCustomTab)
Creates a description of a browser from the core properties that are frequently used to
decide whether a browser can be used for an authorization flow. In most cases, it is
more convenient to use the other variant of the constructor that consumes a
PackageInfo object provided by the package manager.
packageName - The Android package name of the browser.signatureHashes - The set of SHA-512, Base64 url safe encoded signatures for the app. This can be
generated for a signature by calling generateSignatureHash(Signature).version - The version name of the browser.useCustomTab - Whether it is intended to use the browser as a custom tab.@NonNull public BrowserDescriptor changeUseCustomTab(boolean newUseCustomTabValue)
Creates a copy of this browser descriptor, changing the intention to use it as a custom tab to the specified value.
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object@NonNull
public static java.lang.String generateSignatureHash(@NonNull
android.content.pm.Signature signature)
Generates a SHA-512 hash, Base64 url-safe encoded, from a Signature.
@NonNull
public static java.util.Set<java.lang.String> generateSignatureHashes(@NonNull
android.content.pm.Signature[] signatures)
Generates a set of SHA-512, Base64 url-safe encoded signature hashes from the provided array of signatures.