Click or drag to resize

UserInfoExists Property

Gets flag that determines if user exists.

Namespace: GSF.Identity
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.218-beta+101eee949414e414795e55a6e73d88938f0177b8
Syntax
public bool Exists { get; }
View Source

Return Value

Boolean
true if user is found to exist; otherwise false.
Remarks

Unlike other properties in this class, Exists will still work even if the domain server is unavailable. Calling this property without access to a domain server will return true if the user is authenticated. This only succeeds if the current user is the same as the LoginID, there is no way to determine if a user other than the currently authenticated user exists without access to the domain server. Local accounts are not subject to these constraints since the domain server will effectively be your local computer which is always accessible.

Since this property can check the WindowsPrincipal to determine if the current thread identity is authenticated, it is important that consumers add the following code at application startup:

C#
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);

If a laptop user that's normally connected to the domain takes their computer on the road without VPN or other connectivity to the domain, the user can still login to the laptop using cached credentials therefore they are still considered to exist. Without access to the domain, no user information will be available (such as the Groups listing) - if this data is needed offline it will need to be cached by the application in anticipation of offline access.

See Also