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 StringpackageNameThe package name of the browser app.Set<String>signatureHashesThe set ofsignaturesof the browser app, which have been hashed with SHA-512, and Base-64 URL-safe encoded.BooleanuseCustomTabWhether it is intended that the browser will be used via a custom tab.StringversionThe version string of the browser app.
-
Constructor Summary
Constructors Constructor Description BrowserDescriptor(PackageInfo packageInfo, boolean useCustomTab)Creates a description of a browser from aPackageInfoobject 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 BrowserDescriptorchangeUseCustomTab(boolean newUseCustomTabValue)Creates a copy of this browser descriptor, changing the intention to use it as a custom tab to the specified value.booleanequals(Object obj)static StringgenerateSignatureHash(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.inthashCode()
-
-
-
Field Detail
-
packageName
public final String packageName
The package name of the browser app.
-
signatureHashes
public final Set<String> signatureHashes
The set ofsignaturesof 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 aPackageInfoobject returned from thePackageManager.The object is expected to include the signatures of the app, which can be retrieved with the
GET_SIGNATURESflag 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
PackageInfoobject 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.
-
-