Esempio 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;
        }
Esempio n. 3
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();
        }