Skip to content

Commit

Permalink
[flutter_appauth] Fix allowInsecureConnections not effect when servic…
Browse files Browse the repository at this point in the history
…eConfigurationParameters is null (MaikuB#139)

* Fix allowInsecureConnections not effect when serviceConfigurationParameters is null

* Bump up version to 0.9.2+4

* Fix imports

* Remove insecure connection support from fetchFromIssuer

* Removed TODO comments

* add changelog entry for 0.9.2+4

Co-authored-by: Michael Bui <[email protected]>
  • Loading branch information
xuhongxu96 and MaikuB authored Sep 4, 2020
1 parent 020a19d commit 4977dfc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions flutter_appauth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.9.2+4

* [Android] fix issue [131](https://github.com/MaikuB/flutter_appauth/issues/131) where setting the `allowInsecureConnections` flag to true whilst doing an authorisation or token request didn't behave as expected. Thanks to the PR from [Hongxu Xu](https://github.com/xuhongxu96)

## 0.9.2+3

* [Android] fix issue [79](https://github.com/MaikuB/flutter_appauth/issues/79) where an authorisation request could cause the UI to momentarily hang due to AppAuth trying to warm up the browser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import net.openid.appauth.TokenRequest;
import net.openid.appauth.TokenResponse;

import net.openid.appauth.connectivity.DefaultConnectionBuilder;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -234,10 +236,9 @@ public void onFetchConfigurationCompleted(@Nullable AuthorizationServiceConfigur
}
};
if (tokenRequestParameters.discoveryUrl != null) {
AuthorizationServiceConfiguration.fetchFromUrl(Uri.parse(tokenRequestParameters.discoveryUrl), callback);
AuthorizationServiceConfiguration.fetchFromUrl(Uri.parse(tokenRequestParameters.discoveryUrl), callback, allowInsecureConnections ? InsecureConnectionBuilder.INSTANCE : DefaultConnectionBuilder.INSTANCE);
} else {
AuthorizationServiceConfiguration.fetchFromIssuer(Uri.parse(tokenRequestParameters.issuer), callback);

}
}

Expand All @@ -264,7 +265,7 @@ public void onFetchConfigurationCompleted(@Nullable AuthorizationServiceConfigur
finishWithDiscoveryError(ex);
}
}
});
}, allowInsecureConnections ? InsecureConnectionBuilder.INSTANCE : DefaultConnectionBuilder.INSTANCE);

} else {

Expand Down
8 changes: 4 additions & 4 deletions flutter_appauth/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: flutter_appauth
description: This plugin provides an abstraction around the Android and iOS AppAuth SDKs so it can be used to communicate with OAuth 2.0 and OpenID Connect providers
version: 0.9.2+3
version: 0.9.2+4
homepage: https://github.com/MaikuB/flutter_appauth/tree/master/flutter_appauth

environment:
sdk: ">=2.6.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5"
sdk: '>=2.6.0 <3.0.0'
flutter: '>=1.12.13+hotfix.5'

dependencies:
flutter:
Expand All @@ -19,4 +19,4 @@ flutter:
package: io.crossingthestreams.flutterappauth
pluginClass: FlutterAppauthPlugin
ios:
pluginClass: FlutterAppauthPlugin
pluginClass: FlutterAppauthPlugin

0 comments on commit 4977dfc

Please sign in to comment.