-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
159 additions
and
170 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
34 changes: 34 additions & 0 deletions
34
src/main/java/io/split/android/client/network/SplitUrlConnectionAuthenticator.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,34 @@ | ||
package io.split.android.client.network; | ||
|
||
import java.net.HttpURLConnection; | ||
import java.util.Map; | ||
|
||
class SplitUrlConnectionAuthenticator { | ||
|
||
private final SplitAuthenticator mProxyAuthenticator; | ||
|
||
SplitUrlConnectionAuthenticator(SplitAuthenticator splitAuthenticator) { | ||
mProxyAuthenticator = splitAuthenticator; | ||
} | ||
|
||
HttpURLConnection authenticate(HttpURLConnection connection) { | ||
SplitAuthenticatedRequest authenticatedRequest = mProxyAuthenticator.authenticate(new SplitAuthenticatedRequest(connection)); | ||
if (authenticatedRequest != null) { | ||
Map<String, String> headers = authenticatedRequest.getHeaders(); | ||
|
||
if (headers != null) { | ||
for (Map.Entry<String, String> entry : headers.entrySet()) { | ||
if (entry == null || entry.getKey() == null || entry.getValue() == null) { | ||
continue; | ||
} | ||
|
||
connection.addRequestProperty(entry.getKey(), entry.getValue()); | ||
} | ||
|
||
return connection; | ||
} | ||
} | ||
|
||
return connection; | ||
} | ||
} |
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
103 changes: 0 additions & 103 deletions
103
src/test/java/io/split/android/client/network/SplitOkHttpAuthenticatorTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.