Take a survey

API Quick Starts (Code Examples) > User Manager API Quick Starts > Quick Start: Authenticating a user using the web service API

Quick Start: Authenticating a user using the web service API
The following C# .NET code example authenticates a user.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO; 
 
namespace ManageUsersWSApp
{
    class AuthenticateUserTest
	{
		[STAThread]
		static void Main(string[] args)
		{
            try
            {
                // Create a AuthenticationManagerServiceService  object
                AuthenticationManagerServiceService svc = new AuthenticationManagerServiceService();
 
                // Provide authentication credentials to the service
                svc.Credentials = new System.Net.NetworkCredential(
                    "administrator", 
                    "password"
                );
 
                // Authenticate the user
                string username = "administrator";
                string password = "password";
                char[] passwordchars = password.ToCharArray();
                byte[] passwordbytes = new byte[passwordchars.Length];
                for (int i = 0; i < passwordchars.Length; i++)
                    passwordbytes[i] = (byte)(passwordchars[i]);
                AuthResult authResult = svc.authenticate(username, passwordbytes);
 
                // Get the authenticated user’s information
                User authUser = authResult.authenticatedUser;
                Console.WriteLine("Authenticated user’s canonical name: " + authUser.canonicalName);
                Console.WriteLine("Authenticated user’s domain name: " + authUser.domainName);
            }
            catch (Exception ee)
            {
                Console.WriteLine("An unexpected exception was encountered: " + ee.Message + "\n" + ee.StackTrace);
            }
        }
	}
}
 
 
 

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/quickStarts_UserManager.17.7.html