Package net.openid.appauth.browser
Class BrowserDescriptor
- java.lang.Object
-
- net.openid.appauth.browser.BrowserDescriptor
-
public class BrowserDescriptor extends Object
Represents a browser that may be used for an authorization flow.
-
-
Field Summary
Fields Modifier and Type Field Description String
packageName
The package name of the browser app.Set<String>
signatureHashes
The set ofsignatures
of the browser app, which have been hashed with SHA-512, and Base-64 URL-safe encoded.Boolean
useCustomTab
Whether it is intended that the browser will be used via a custom tab.String
version
The version string of the browser app.
-
Constructor Summary
Constructors Constructor Description BrowserDescriptor(PackageInfo packageInfo, boolean useCustomTab)
Creates a description of a browser from aPackageInfo
object returned from thePackageManager
.BrowserDescriptor(String packageName, Set<String> signatureHashes, 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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(Object obj)
static String
generateSignatureHash(Signature signature)
Generates a SHA-512 hash, Base64 url-safe encoded, from aSignature
.static Set<String>
generateSignatureHashes(Signature[] signatures)
Generates a set of SHA-512, Base64 url-safe encoded signature hashes from the provided array of signatures.int
hashCode()
-
-
-
Field Detail
-
packageName
public final String packageName
The package name of the browser app.
-
signatureHashes
public final Set<String> signatureHashes
The set ofsignatures
of the browser app, which have been hashed with SHA-512, and Base-64 URL-safe encoded.
-
useCustomTab
public final Boolean useCustomTab
Whether it is intended that the browser will be used via a custom tab.
-
-
Constructor Detail
-
BrowserDescriptor
public BrowserDescriptor(@NonNull PackageInfo packageInfo, boolean useCustomTab)
Creates a description of a browser from aPackageInfo
object returned from thePackageManager
.The object is expected to include the signatures of the app, which can be retrieved with the
GET_SIGNATURES
flag when callingPackageManager.getPackageInfo(String, int)
.
-
BrowserDescriptor
public BrowserDescriptor(@NonNull String packageName, @NonNull Set<String> signatureHashes, @NonNull 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.- Parameters:
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 callinggenerateSignatureHash(Signature)
.version
- The version name of the browser.useCustomTab
- Whether it is intended to use the browser as a custom tab.
-
-
Method Detail
-
changeUseCustomTab
@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.
-
generateSignatureHash
@NonNull public static String generateSignatureHash(@NonNull Signature signature)
Generates a SHA-512 hash, Base64 url-safe encoded, from aSignature
.
-
-