Class BrowserSelector
- java.lang.Object
-
- net.openid.appauth.browser.BrowserSelector
-
public final class BrowserSelector extends Object
Utility class to obtain the browser package name to be used forAuthorizationService.performAuthorizationRequest( net.openid.appauth.AuthorizationRequest, android.app.PendingIntent)
calls.It prioritizes browsers which support custom tabs. To mitigate man-in-the-middle attacks by malicious apps pretending to be browsers for the specific URI we query, only those which are registered as a handler for all HTTP and HTTPS URIs will be used.
-
-
Constructor Summary
Constructors Constructor Description BrowserSelector()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<BrowserDescriptor>
getAllBrowsers(Context context)
Retrieves the full list of browsers installed on the device.static BrowserDescriptor
select(Context context, BrowserMatcher browserMatcher)
Searches through all browsers for the best match based on the supplied browser matcher.
-
-
-
Constructor Detail
-
BrowserSelector
public BrowserSelector()
-
-
Method Detail
-
getAllBrowsers
@NonNull public static List<BrowserDescriptor> getAllBrowsers(Context context)
Retrieves the full list of browsers installed on the device.Two entries will exist for each browser that supports custom tabs, with the
BrowserDescriptor.useCustomTab
flag set totrue
in one andfalse
in the other. The list is in the order returned by the package manager, so indirectly reflects the user’s preferences (i.e. their default browser, if set, should be the first entry in the list).
-
select
@Nullable public static BrowserDescriptor select(Context context, BrowserMatcher browserMatcher)
Searches through all browsers for the best match based on the supplied browser matcher.Custom tab supporting browsers are preferred, if the matcher permits them, and browsers are evaluated in the order returned by the package manager, which should indirectly match the user’s preferences.
- Parameters:
context
-Context
to use for accessingPackageManager
.- Returns:
- The package name recommended to use for connecting to custom tabs related components.
-
-