示例#1
0
        private KerberosAuthorizationDataPACDevice(byte[] data, PAC_DEVICE_INFO device_info)
            : base(KerberosAuthorizationDataPACEntryType.Device, data)
        {
            Sid account_domain_sid = device_info.AccountDomainId.GetValue().ToSid();

            DeviceId       = account_domain_sid.CreateRelative((uint)device_info.UserId);
            PrimaryGroupId = account_domain_sid.CreateRelative((uint)device_info.PrimaryGroupId);
            List <UserGroup> groups = new List <UserGroup>();

            if (device_info.AccountGroupIds != null)
            {
                groups.AddRange(device_info.AccountGroupIds.GetValue()
                                .Select(g => new UserGroup(account_domain_sid.CreateRelative((uint)g.RelativeId), (GroupAttributes)g.Attributes)));
            }
            AccountGroups = groups.AsReadOnly();

            groups = new List <UserGroup>();
            if (device_info.ExtraSids != null)
            {
                groups.AddRange(device_info.ExtraSids.GetValue()
                                .Select(g => new UserGroup(g.Sid.GetValue().ToSid(), (GroupAttributes)g.Attributes)));
            }
            ExtraSids = groups.AsReadOnly();

            groups = new List <UserGroup>();
            if (device_info.DomainGroup != null)
            {
                foreach (var group in device_info.DomainGroup.GetValue())
                {
                    if (group.GroupIds != null)
                    {
                        Sid group_sid = group.DomainId.GetValue().ToSid();
                        groups.AddRange(group.GroupIds.GetValue()
                                        .Select(g => new UserGroup(group_sid.CreateRelative((uint)g.RelativeId), (GroupAttributes)g.Attributes)));
                    }
                }
            }
            DomainGroups = groups.AsReadOnly();
        }