问题
Recently, I have been working on a CredentialProvider in order to unlock automatically (the trigger can be any event, so let’s say the end of a timer) a Windows Vista (or more recent version) user session.
For that I read some useful articles on the subject, the change between GINA and this new architecture. http://msdn.microsoft.com/en-us/magazine/cc163489.aspx.
I think, like everyone in the process of creating a custom CredentialProvider, I didn’t start from scratch but from the sample code provided by Microsoft. And then I tried to change the behaviour (things like logging) in the different functions.
So in the end I can use the custom CredentialProvider, enter the SetUsageScenario methods but still I cannot reach the Set or GetSerialization method. From what I’ve understood in the technical documentation on CredentialProvider (still provided by Microsoft) theses two methods should be called automatically. Is there something I missed ?
Also, my original idea was to get an authentication package using Kerberos in order to perform an implicit user authentication. I got this idea by seeking information on other SO or MSDN threads like
Is this approach the good one ?
Thank you very much for your time answering my questions. Any clarifications are welcomed, even if they don’t directly resolve my problems :-)
回答1:
First of all - you need to set autologon flag to true in your implementation of the ICredentialProviderCredential::SetSelected(BOOL *pbAutoLogon)
and ICredentialProvider::GetCredentialCount
methods.
Next, you need to call ICredentialProviderEvents::CredentialsChanged
when your timer is hit.
LogonUI will recreate your credentials, and because autologon is set to true it will call your GetSerialization()
method.
回答2:
SetSerialization
and GetSerialization
functions are called from your provider by LogonUI
.
After user enters username/password and presses ENTER button, LogonUI calls GetSerialization
function and provides a pointer, as one of the four parameters, that will point in future to CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION
structure created and filled by you, and then this structure will be sent from LogonUI
to Winlogon
to perform authentication.
I don't know how to make LogonUI to call GetSerialization
from your credential provider code and as far as I know you can't call GetSerialization
by your own because where will you pass your filled CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION
structure if no one requested it, but only LogonUI
can path it to Winlogon
?
There is a document called "Credential Provider Technical Reference", there you can read some details about credential providers. In the Shell samples folder there is a strange folder called "Autologon", maybe it will help you! Good Luck!
来源:https://stackoverflow.com/questions/13734982/autounlock-a-windows-user-session