From 96bff2852a66dab11322f4acc74906e07cb2529d Mon Sep 17 00:00:00 2001 From: Ryan Newington Date: Fri, 18 Oct 2024 10:33:41 +1100 Subject: [PATCH] Breaking change: Add autoLogon parameter to OnSelected method Modified the `OnSelected` method in the `CredentialTile` class to include an `out` parameter named `autoLogon`, which determines if the logon should proceed immediately. Updated XML documentation to explain the new parameter and its behavior in Windows 10. Adjusted the `SetSelected` method in `CredentialTile.ICredentialProviderCredential` to call the updated `OnSelected` method and set `pbAutoLogon` based on the returned `autoLogon` value. Removed the previous `OnSelected` implementation without parameters. There was confusion between a tile that is configured as a default auto logon tile, and a tile that can be auto logged-on when selecteed. This change clarifies the case of a tile allowing login when selected, without having to press a submit button. The AutoLogon propert of the CredentialTile object is no longer used in this scenario. Implementers must override OnSelected(out bool autoLogon) to automatically logon a tile when selected --- .../CredentialTile.ICredentialProviderCredential.cs | 4 ++-- src/Lithnet.CredentialProvider/CredentialTile.cs | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Lithnet.CredentialProvider/CredentialTile.ICredentialProviderCredential.cs b/src/Lithnet.CredentialProvider/CredentialTile.ICredentialProviderCredential.cs index 81b0362..7b858aa 100644 --- a/src/Lithnet.CredentialProvider/CredentialTile.ICredentialProviderCredential.cs +++ b/src/Lithnet.CredentialProvider/CredentialTile.ICredentialProviderCredential.cs @@ -66,8 +66,8 @@ namespace Lithnet.CredentialProvider { this.logger.LogTrace("SetSelected"); this.IsSelected = true; - pbAutoLogon = this.IsAutoLogon ? 1 : 0; - this.OnSelected(); + this.OnSelected(out bool autoLogon); + pbAutoLogon = autoLogon ? 1 : 0; return HRESULT.S_OK; } catch (Exception ex) diff --git a/src/Lithnet.CredentialProvider/CredentialTile.cs b/src/Lithnet.CredentialProvider/CredentialTile.cs index f756f59..9290143 100644 --- a/src/Lithnet.CredentialProvider/CredentialTile.cs +++ b/src/Lithnet.CredentialProvider/CredentialTile.cs @@ -164,7 +164,14 @@ namespace Lithnet.CredentialProvider /// /// Called when the user selects this tile /// - protected virtual void OnSelected() { } + /// A value that indicates if logon should be performed immediately, without waiting for further user input + /// + /// In Windows 10, if a credential provider wants to automatically log the user on in a situation Windows does not think is appropriate, the system will display a sign in button as a speed bump. One example of this is when a user with an empty password locks the computer or signs out. In that scenario, Windows does not directly log the user back in. + /// + protected virtual void OnSelected(out bool autoLogon) + { + autoLogon = false; + } /// /// Called when a user deselects this tile