-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for specifying what browser needs to be used for autho…
…rization (#655) * iOS - Adding custom browser parameter (work in progress). * iOS - Making the ios custom browser parameter optional. * Readme - Adding documentation for new parameter. * Android - Adding allow browsers list parameter for authorize method. * Readme - Adding documentation about android custom browsers parameter. * Fixing white space. * Tests - Adjusting unit tests to include custom browser arguments. * Custom browser - Fixing compile issues. Co-authored-by: Ted de Koning <ted@q42.nl>
- Loading branch information
Showing
7 changed files
with
253 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
android/src/main/java/com/rnappauth/utils/MutableBrowserAllowList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.rnappauth.utils; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import net.openid.appauth.browser.BrowserDescriptor; | ||
import net.openid.appauth.browser.BrowserMatcher; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class MutableBrowserAllowList implements BrowserMatcher { | ||
|
||
private final List<BrowserMatcher> mBrowserMatchers = new ArrayList<>(); | ||
|
||
public void add(BrowserMatcher browserMatcher) { | ||
mBrowserMatchers.add(browserMatcher); | ||
} | ||
|
||
public void remove(BrowserMatcher browserMatcher) { | ||
mBrowserMatchers.remove(browserMatcher); | ||
} | ||
|
||
@Override | ||
public boolean matches(@NonNull BrowserDescriptor descriptor) { | ||
for (BrowserMatcher matcher : mBrowserMatchers) { | ||
if (matcher.matches(descriptor)) { | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.