This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[local_auth] Windows support. #4806
Merged
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
7ccd968
[local_auth] Windows support.
azchohfi 3906da5
Merge branch 'main' into local_auth_windows
azchohfi 70c341d
Merge branch 'main' into local_auth_windows
azchohfi c492f89
Merge branch 'main' into local_auth_windows
azchohfi c997ad8
Handling biometricOnly parameter.
azchohfi 9cf0a1a
Merge branch 'main' into local_auth_windows
azchohfi 975ca8d
Fixed readme
azchohfi 3fcbca7
[local_auth] Fix version and readme.
azchohfi 34afbf5
Merge branch 'main' into local_auth_windows
azchohfi 835f5cc
[local_auth] Small fixes.
azchohfi 9eaba3c
Small fix.
azchohfi 22ec14c
Fixed tests.
azchohfi 9349aab
Added local_auth_windows tests.
azchohfi 1032693
PR Feedback.
azchohfi 1659e49
Merge branch 'local_auth_windows' of https://github.com/azchohfi/plug…
azchohfi 8c7a87b
Fixed tests.
azchohfi bf47529
Added more tests.
azchohfi 8143983
Revert changes in local_auth.
azchohfi bcf105b
Merge branch 'main' into local_auth_windows
azchohfi a4f02f4
Merge branch 'main' into local_auth_windows
azchohfi 7449a5c
Merge branch 'main' into local_auth_windows
azchohfi fb26c93
Merge branch 'main' into local_auth_windows
azchohfi e9ab4ef
[local_auth_windows] Fixed authors list.
azchohfi 30f0958
[local_auth_windows] Fixed changelog.
azchohfi 97e1ee9
[local_auth_windows] PR feedback.
azchohfi 40aa9a2
Merge branch 'main' into local_auth_windows
azchohfi 6813b7b
Fixed build
azchohfi 47823c6
Fixed format.
azchohfi 45ceb6e
Merge branch 'main' into local_auth_windows
azchohfi 271a49e
Applied more PR feedback.
azchohfi e1e24a6
Added C++ comments.
azchohfi cabc43e
Small doc fixes.
azchohfi 34a58de
Merge branch 'main' into local_auth_windows
azchohfi 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
Fixed tests.
- Loading branch information
commit 8c7a87bf43a43790040a8e282de559075a190de8
There are no files selected for viewing
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
72 changes: 72 additions & 0 deletions
72
packages/local_auth/local_auth_windows/windows/local_auth.h
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,72 @@ | ||
| // 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. | ||
|
|
||
| #include <UserConsentVerifierInterop.h> | ||
|
|
||
| #include "include/local_auth_windows/local_auth_plugin.h" | ||
|
|
||
| // This must be included before many other Windows headers. | ||
| #include <flutter/encodable_value.h> | ||
| #include <flutter/method_channel.h> | ||
| #include <flutter/plugin_registrar_windows.h> | ||
| #include <flutter/standard_method_codec.h> | ||
| #include <pplawait.h> | ||
| #include <ppltasks.h> | ||
| #include <windows.h> | ||
| #include <winrt/Windows.Foundation.h> | ||
| #include <winrt/Windows.Security.Credentials.UI.h> | ||
| #include <winstring.h> | ||
|
|
||
| #include <map> | ||
| #include <memory> | ||
| #include <sstream> | ||
|
|
||
| namespace local_auth_windows { | ||
|
|
||
| using namespace flutter; | ||
| using namespace winrt; | ||
azchohfi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| class UserConsentVerifier { | ||
azchohfi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| public: | ||
| UserConsentVerifier() {} | ||
| virtual ~UserConsentVerifier() = default; | ||
|
|
||
| virtual Windows::Foundation::IAsyncOperation< | ||
| Windows::Security::Credentials::UI::UserConsentVerificationResult> | ||
| RequestVerificationForWindowAsync(std::wstring localizedReason) = 0; | ||
| virtual Windows::Foundation::IAsyncOperation< | ||
| Windows::Security::Credentials::UI::UserConsentVerifierAvailability> | ||
| CheckAvailabilityAsync() = 0; | ||
|
|
||
| // Disallow copy and move. | ||
| UserConsentVerifier(const UserConsentVerifier&) = delete; | ||
| UserConsentVerifier& operator=(const UserConsentVerifier&) = delete; | ||
| }; | ||
|
|
||
| class LocalAuthPlugin : public Plugin { | ||
| public: | ||
| static void RegisterWithRegistrar(PluginRegistrarWindows* registrar); | ||
|
|
||
| LocalAuthPlugin(std::function<HWND()> window_provider); | ||
| LocalAuthPlugin(std::unique_ptr<UserConsentVerifier> user_consent_verifier); | ||
azchohfi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Called when a method is called on this plugin's channel from Dart. | ||
azchohfi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| void HandleMethodCall(const MethodCall<EncodableValue>& method_call, | ||
| std::unique_ptr<MethodResult<EncodableValue>> result); | ||
|
|
||
| virtual ~LocalAuthPlugin(); | ||
|
|
||
| private: | ||
| std::unique_ptr<UserConsentVerifier> user_consent_verifier_; | ||
|
|
||
| winrt::fire_and_forget Authenticate( | ||
| const MethodCall<EncodableValue>& method_call, | ||
| std::unique_ptr<MethodResult<EncodableValue>> result); | ||
| winrt::fire_and_forget GetAvailableBiometrics( | ||
| std::unique_ptr<MethodResult<EncodableValue>> result); | ||
| winrt::fire_and_forget IsDeviceSupported( | ||
| std::unique_ptr<MethodResult<EncodableValue>> result); | ||
| }; | ||
|
|
||
| } // namespace local_auth_windows | ||
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
15 changes: 15 additions & 0 deletions
15
packages/local_auth/local_auth_windows/windows/local_auth_windows.cpp
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,15 @@ | ||
| // 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. | ||
|
|
||
| #include <flutter/plugin_registrar_windows.h> | ||
|
|
||
| #include "include/local_auth_windows/local_auth_plugin.h" | ||
| #include "local_auth.h" | ||
|
|
||
| void LocalAuthPluginRegisterWithRegistrar( | ||
| FlutterDesktopPluginRegistrarRef registrar) { | ||
| local_auth_windows::LocalAuthPlugin::RegisterWithRegistrar( | ||
| flutter::PluginRegistrarManager::GetInstance() | ||
| ->GetRegistrar<flutter::PluginRegistrarWindows>(registrar)); | ||
| } |
Oops, something went wrong.
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.