|
UserInfoAuthenticateUser(String, String, String) Method
|
Authenticates the specified user credentials.
Namespace: GSF.IdentityAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.246-beta+ff392465a0262ee2737937d4127fc3c2f08c6dcd
Syntaxpublic static IPrincipal AuthenticateUser(
string domain,
string userName,
string password
)
Public Shared Function AuthenticateUser (
domain As String,
userName As String,
password As String
) As IPrincipal
public:
static IPrincipal^ AuthenticateUser(
String^ domain,
String^ userName,
String^ password
)
static member AuthenticateUser :
domain : string *
userName : string *
password : string -> IPrincipal
GSF.Identity.UserInfo.AuthenticateUser = function(domain, userName, password);
View SourceParameters
- domain String
- Domain of user to authenticate.
- userName String
- Username of user to authenticate.
- password String
- Password of user to authenticate.
Return Value
IPrincipaltrue if the user credentials are authenticated successfully; otherwise false.
Example
This example shows how to validate a user's credentials:
using System;
using GSF.Identity;
class Program
{
static void Main(string[] args)
{
string domain = "XYZCorp";
string username = "johndoe";
string password = "password";
if (UserInfo.AuthenticateUser(domain, username, password) is not null)
Console.WriteLine("Successfully authenticated user \"{0}\\{1}\".", domain, username);
else
Console.WriteLine("Failed to authenticate user \"{0}\\{1}\".", domain, username);
Console.ReadLine();
}
}
See Also