Improve SGU logon resilience and client UX
This commit is contained in:
@@ -10,9 +10,11 @@ namespace SGU.CredentialProvider.SmokeProbe;
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly Guid ProviderClassId = new("D789CFD8-5AD4-489F-9B83-7EB5D9D09335");
|
||||
private static readonly Guid ProviderLogoFieldType = new("2D837775-F6CD-464E-A745-482FD0B47493");
|
||||
|
||||
private static readonly string[] ExpectedLabels =
|
||||
[
|
||||
"Acceso institucional SGU",
|
||||
"Acceso institucional SGU",
|
||||
"Usa tu clave institucional (DO, AL o AD + 6 dígitos) y contraseña.",
|
||||
"Clave institucional",
|
||||
@@ -52,6 +54,7 @@ internal static class Program
|
||||
ThrowIfFailed(provider.GetFieldDescriptorCount(out uint fieldCount), "GetFieldDescriptorCount");
|
||||
|
||||
List<string> labels = [];
|
||||
bool providerLogoPresent = false;
|
||||
for (uint index = 0; index < fieldCount; index++)
|
||||
{
|
||||
ThrowIfFailed(provider.GetFieldDescriptorAt(index, out IntPtr descriptorPointer), "GetFieldDescriptorAt");
|
||||
@@ -64,6 +67,8 @@ internal static class Program
|
||||
{
|
||||
FieldDescriptor descriptor = Marshal.PtrToStructure<FieldDescriptor>(descriptorPointer);
|
||||
labels.Add(descriptor.Label ?? string.Empty);
|
||||
providerLogoPresent |= descriptor.FieldType == FieldType.TileImage &&
|
||||
descriptor.FieldTypeGuid == ProviderLogoFieldType;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -81,6 +86,7 @@ internal static class Program
|
||||
bool passed = fieldCount == ExpectedLabels.Length &&
|
||||
credentialCount == 1 &&
|
||||
credential != IntPtr.Zero &&
|
||||
providerLogoPresent &&
|
||||
labels.SequenceEqual(ExpectedLabels, StringComparer.Ordinal);
|
||||
|
||||
if (mode != "enumeration" && passed)
|
||||
@@ -96,6 +102,7 @@ internal static class Program
|
||||
usageScenario = "Logon",
|
||||
fieldCount,
|
||||
labels,
|
||||
providerLogoPresent,
|
||||
credentialCount,
|
||||
defaultIndex,
|
||||
autoLogon = autoLogon != 0
|
||||
|
||||
Reference in New Issue
Block a user