Ejemplo n.º 1
0
        public KerberosClientSecurityContext(AccountCredential clientCredential, string serviceName, ClientSecurityContextAttribute contextAttributes)
        {
            if (clientCredential.DomainName == null)
            {
                throw new ArgumentNullException(nameof(clientCredential.DomainName));
            }
            if (clientCredential.AccountName == null)
            {
                throw new ArgumentNullException(nameof(clientCredential.AccountName));
            }
            if (clientCredential.Password == null)
            {
                throw new ArgumentNullException(nameof(clientCredential.Password));
            }
            if (serviceName == null)
            {
                throw new ArgumentNullException(nameof(serviceName));
            }

            this.contextAttribute = contextAttributes;
            client = new KileClient(clientCredential.DomainName, clientCredential.AccountName, clientCredential.Password,
                                    KileAccountType.User);
            this.serverName = serviceName;
            domain          = clientCredential.DomainName;
            userLogonName   = clientCredential.AccountName;
            client.Connect(clientCredential.DomainName, ConstValue.KDC_PORT, KileConnectionType.TCP);
            InitContextSize();
        }
        public KerberosClientSecurityContext(AccountCredential clientCredential,
                                             string logonName,
                                             string serviceName,
                                             IPAddress kdcIpAddress,
                                             ClientSecurityContextAttribute contextAttributes,
                                             KileConnectionType transportType)
        {
            if (clientCredential.DomainName == null)
            {
                throw new ArgumentNullException(nameof(clientCredential.DomainName));
            }
            if (clientCredential.AccountName == null)
            {
                throw new ArgumentNullException(nameof(clientCredential.AccountName));
            }
            if (clientCredential.Password == null)
            {
                throw new ArgumentNullException(nameof(clientCredential.Password));
            }
            if (kdcIpAddress == null)
            {
                throw new ArgumentNullException(nameof(kdcIpAddress));
            }
            if (logonName == null)
            {
                throw new ArgumentNullException(nameof(logonName));
            }
            if (serviceName == null)
            {
                throw new ArgumentNullException(nameof(serviceName));
            }

            client = new KileClient(clientCredential.DomainName, clientCredential.AccountName, clientCredential.Password,
                                    KileAccountType.User);
            service          = serviceName;
            domain           = clientCredential.DomainName;
            userLogonName    = logonName;
            contextAttribute = contextAttributes;
            client.Connect(kdcIpAddress.ToString(), ConstValue.KDC_PORT, transportType);
            contextSizes = new SecurityPackageContextSizes();
            contextSizes.MaxTokenSize        = ConstValue.MAX_TOKEN_SIZE;
            contextSizes.MaxSignatureSize    = ConstValue.MAX_SIGNATURE_SIZE;
            contextSizes.BlockSize           = ConstValue.BLOCK_SIZE;
            contextSizes.SecurityTrailerSize = ConstValue.SECURITY_TRAILER_SIZE;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Release resources.
        /// </summary>
        /// <param name="disposing">If disposing equals true, Managed and unmanaged resources are disposed.
        /// if false, Only unmanaged resources can be disposed.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    //Release managed resource.
                    if (client != null)
                    {
                        client.Dispose();
                        client = null;
                    }
                }

                //Note disposing has been done.
                disposed = true;
            }
        }
Ejemplo n.º 4
0
        public KerberosClientSecurityContext(AccountCredential clientCredential,
                                             string logonName,
                                             string serviceName,
                                             IPAddress kdcIpAddress,
                                             ClientSecurityContextAttribute contextAttributes,
                                             KileConnectionType transportType)
        {
            if (clientCredential.DomainName == null)
            {
                throw new ArgumentNullException(nameof(clientCredential.DomainName));
            }
            if (clientCredential.AccountName == null)
            {
                throw new ArgumentNullException(nameof(clientCredential.AccountName));
            }
            if (clientCredential.Password == null)
            {
                throw new ArgumentNullException(nameof(clientCredential.Password));
            }
            if (kdcIpAddress == null)
            {
                throw new ArgumentNullException(nameof(kdcIpAddress));
            }
            if (logonName == null)
            {
                throw new ArgumentNullException(nameof(logonName));
            }
            if (serviceName == null)
            {
                throw new ArgumentNullException(nameof(serviceName));
            }

            client = new KileClient(clientCredential.DomainName, clientCredential.AccountName, clientCredential.Password,
                                    KileAccountType.User);
            this.serverName  = serviceName;
            domain           = clientCredential.DomainName;
            userLogonName    = logonName;
            contextAttribute = contextAttributes;
            client.Connect(kdcIpAddress.ToString(), ConstValue.KDC_PORT, transportType);
            InitContextSize();
        }