Skip to content

Commit

Permalink
🐛 SRI hack doesn't work for multi-org (#277)
Browse files Browse the repository at this point in the history
- Strip SRI from both app URL and Org domains

Resolves #276
  • Loading branch information
AlainODea authored Feb 28, 2019
1 parent c86849f commit 0c12a97
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.net.URL;
import java.net.URLConnection;
import java.util.Arrays;
import java.util.List;
import java.util.function.BiFunction;
import java.util.logging.Logger;

Expand All @@ -24,12 +25,18 @@ final class LoginPageInterceptingProtocolHandler extends sun.net.www.protocol.ht
@Override
protected URLConnection openConnection(URL url, Proxy proxy) throws IOException {
URLConnection urlConnection = super.openConnection(url, proxy);
if (environment.oktaOrg.equals(url.getHost()) &&
Arrays.asList(
URI.create(environment.oktaAwsAppUrl).getPath(),
"/login/login.htm",
"/auth/services/devicefingerprint"
).contains(url.getPath())
URI oktaAwsAppUri = URI.create(environment.oktaAwsAppUrl);
List<String> domainsToIntercept = Arrays.asList(
environment.oktaOrg,
oktaAwsAppUri.getHost()
);
List<String> requestPathsToIntercept = Arrays.asList(
oktaAwsAppUri.getPath(),
"/login/login.htm",
"/auth/services/devicefingerprint"
);
if (domainsToIntercept.contains(url.getHost()) &&
requestPathsToIntercept.contains(url.getPath())
) {
LOGGER.finest(() -> String.format("[%s] Using filtering URLConnection", url));
return filteringUrlConnectionFactory.apply(url, urlConnection);
Expand Down

0 comments on commit 0c12a97

Please sign in to comment.