Ejemplo n.º 1
0
        public string GetAuthenticationData(string user)
        {
            IAuthenticationRepository repository = Utils.COMCreateObject <IAuthenticationRepository>("CCOW.AuthenticationRepository");
            string data = string.Empty;

            if (repository != null)
            {
                int coupon = repository.Connect(_ApplicationName);

                if (coupon != 0)
                {
                    try
                    {
                        ISecureBinding sb = repository as ISecureBinding;

                        if (sb != null)
                        {
                            string signature = string.Empty;

                            SecureBind(coupon, sb);
                            signature = coupon.ToString() + user;
                            signature = CreateSignature(signature);
                            repository.GetAuthenticationData(coupon, user, string.Empty, signature, out data);
                        }
                    }
                    catch (COMException e)
                    {
                        if (e.ErrorCode != (int)HResult.LogonNotFound)
                        {
                            throw e;
                        }
                    }
                    finally
                    {
                        repository.Disconnect(coupon);
                    }
                }
            }
            return(data);
        }