-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[webview_flutter] Support for handling basic authentication requests (Platform Interface) #5362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
auto-submit
merged 48 commits into
flutter:main
from
andreisas06:webview-auth-request-platform-interface
Nov 20, 2023
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
517e9d4
Implement http basic auth
JeroenWeener 967879b
Apply feedback
JeroenWeener c8624c0
Create HttpAuthHandlerTest.java
JeroenWeener 4f3574d
Format java files
JeroenWeener 1e7f785
Regenerate build_runner files
JeroenWeener 131bc56
Implement feedback
JeroenWeener bc01be4
Remove redundant key in `Info.plist`
JeroenWeener 67aa00e
Update example apps
JeroenWeener 32496d0
Implement http basic auth
JeroenWeener aeb8708
Apply feedback
JeroenWeener fffc4c7
Create HttpAuthHandlerTest.java
JeroenWeener b455040
Format java files
JeroenWeener 2aa9bfe
Regenerate build_runner files
JeroenWeener db286ba
Implement feedback
JeroenWeener 467feb3
Remove redundant key in `Info.plist`
JeroenWeener dad8ae6
Update example apps
JeroenWeener 6f3d802
Merge branch 'webview-auth-request' of https://github.com/andreisas06…
JeroenWeener 0fef591
Add platform interface dev dependency to example
JeroenWeener b2a4fbb
Merge branch 'main' into webview-auth-request
JeroenWeener ce35d9b
Update packages/webview_flutter/webview_flutter_platform_interface/li…
bparrishMines fc32898
Merge branch 'main' of github.com:flutter/packages into webview-auth-…
bparrishMines 4673e65
Merge branch 'webview-auth-request' of github.com:andreisas06/package…
bparrishMines 580521a
Fix some lints, errros and call on errors
bparrishMines d1f305b
fix lints
bparrishMines a3f74be
fix tests
bparrishMines ed3798f
add onProceed and onCancel back
bparrishMines 154c1f8
dont require realm to be nonnull
bparrishMines a0b5c4d
Merge remote-tracking branch 'upstream/main' into webview-auth-reques…
JeroenWeener 9ac132e
Separate platform interface changes
JeroenWeener 9df4152
Delete HttpAuthHandlerFlutterApiImpl.java
JeroenWeener a387bb6
Delete HttpAuthHandlerHostApiImpl.java
JeroenWeener 1e01f79
Delete HttpAuthHandlerTest.java
JeroenWeener 389e9ae
Delete FWFURLAuthenticationChallengeHostApiTests.m
JeroenWeener 3e1a41b
Delete FWFURLCredentialHostApiTests.m
JeroenWeener bfb86aa
Delete FWFURLProtectionSpaceHostApiTests.m
JeroenWeener 7bd194a
Delete FWFURLAuthenticationChallengeHostApi.h
JeroenWeener 34bfa51
Delete FWFURLAuthenticationChallengeHostApi.m
JeroenWeener 290e816
Delete FWFURLCredentialHostApi.h
JeroenWeener 01b22d3
Delete FWFURLCredentialHostApi.m
JeroenWeener e1c0908
Delete FWFURLProtectionSpaceHostApi.h
JeroenWeener 5cac2e3
Delete FWFURLProtectionSpaceHostApi.m
JeroenWeener 5f741ff
Update packages/webview_flutter/webview_flutter_platform_interface/li…
JeroenWeener e8737fc
Update packages/webview_flutter/webview_flutter_platform_interface/li…
JeroenWeener 3b0c25f
Fix typos
JeroenWeener 06993a9
Update packages/webview_flutter/webview_flutter_platform_interface/li…
JeroenWeener b4f3ba2
Merge branch 'webview-auth-request-platform-interface' of https://git…
JeroenWeener 38a0319
Revert bump to `plugin_platform_interface` version
JeroenWeener cc4b4e0
Merge remote-tracking branch 'upstream/main' into webview-auth-reques…
JeroenWeener File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md
This file contains hidden or 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 hidden or 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 hidden or 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
68 changes: 68 additions & 0 deletions
68
...s/webview_flutter/webview_flutter_platform_interface/lib/src/types/http_auth_request.dart
This file contains hidden or 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,68 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:flutter/foundation.dart'; | ||
import 'webview_credential.dart'; | ||
|
||
/// Defines the parameters of a pending HTTP authentication request received by | ||
/// the webview through a [HttpAuthRequestCallback]. | ||
/// | ||
/// Platform specific implementations can add additional fields by extending | ||
/// this class and providing a factory method that takes the [HttpAuthRequest] | ||
/// as a parameter. | ||
/// | ||
/// This example demonstrates how to extend the [HttpAuthRequest] to provide | ||
/// additional platform specific parameters. | ||
/// | ||
/// When extending [HttpAuthRequest], additional parameters should always accept | ||
/// `null` or have a default value to prevent breaking changes. | ||
/// | ||
/// ```dart | ||
/// @immutable | ||
/// class WKWebViewHttpAuthRequest extends HttpAuthRequest { | ||
/// WKWebViewHttpAuthRequest._( | ||
/// HttpAuthRequest authRequest, | ||
/// this.extraData, | ||
/// ) : super( | ||
/// onProceed: authRequest.onProceed, | ||
/// onCancel: authRequest.onCancel, | ||
/// host: authRequest.host, | ||
/// realm: authRequest.realm, | ||
/// ); | ||
/// | ||
/// factory WKWebViewHttpAuthRequest.fromHttpAuthRequest( | ||
/// HttpAuthRequest authRequest, { | ||
/// String? extraData, | ||
/// }) { | ||
/// return WKWebViewHttpAuthRequest._( | ||
/// authRequest, | ||
/// extraData: extraData, | ||
/// ); | ||
/// } | ||
/// | ||
/// final String? extraData; | ||
/// } | ||
/// ``` | ||
@immutable | ||
class HttpAuthRequest { | ||
/// Creates a [HttpAuthRequest]. | ||
const HttpAuthRequest({ | ||
required this.onProceed, | ||
required this.onCancel, | ||
required this.host, | ||
this.realm, | ||
}); | ||
|
||
/// The callback to authenticate. | ||
final void Function(WebViewCredential credential) onProceed; | ||
|
||
/// The callback to cancel authentication. | ||
final void Function() onCancel; | ||
|
||
/// The host requiring authentication. | ||
final String host; | ||
|
||
/// The realm requiring authentication. | ||
final String? realm; | ||
} |
This file contains hidden or 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
24 changes: 24 additions & 0 deletions
24
.../webview_flutter/webview_flutter_platform_interface/lib/src/types/webview_credential.dart
This file contains hidden or 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,24 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:meta/meta.dart'; | ||
|
||
import '../types/http_auth_request.dart'; | ||
|
||
/// Defines the response parameters of a pending [HttpAuthRequest] received by | ||
/// the webview. | ||
@immutable | ||
class WebViewCredential { | ||
/// Creates a [WebViewCredential]. | ||
const WebViewCredential({ | ||
required this.user, | ||
required this.password, | ||
}); | ||
|
||
/// The user name. | ||
final String user; | ||
|
||
/// The password. | ||
final String password; | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.