コード例 #1
0
        public void RemoveAllEntities(MainDbContext context, RadiusDbContext radiusDbContext)
        {
            context.RemoveRange(context.AuthenticationLog);     // 認証操作
            context.RemoveRange(context.AuthenticationState);   // 認証状態
            context.RemoveRange(context.MultiFactor);           // 多要素組合せ
            context.RemoveRange(context.SimAndDevice);          // SIM & 端末組合せ
            context.RemoveRange(context.Sim);                   // SIM
            context.RemoveRange(context.SimGroup);              // SIMグループ

            context.RemoveRange(context.Device);                // 端末
            context.RemoveRange(context.LteModule);             // LTEモジュール
            context.RemoveRange(context.DeviceGroup);           // 端末グループ
            context.RemoveRange(context.DeviceGroupDevice);     // 端末グループ - 端末

            context.RemoveRange(context.OrganizationClientApp); // 組織端末アプリ
            context.RemoveRange(context.ClientApp);             // JinCreek端末アプリ
            context.RemoveRange(context.ClientOs);              // JinCreekサポート端末OS

            context.RemoveRange(context.AvailablePeriod);       // 利用期間
            context.RemoveRange(context.User);                  // ユーザー
            context.RemoveRange(context.UserGroup);             // ユーザーグループ
            context.RemoveRange(context.UserGroupEndUser);      // ユーザーグループ - ユーザー
            context.RemoveRange(context.Domain);                // ドメイン
            context.RemoveRange(context.Organization);          // 組織

            radiusDbContext.RemoveRange(radiusDbContext.Radusergroup);
            radiusDbContext.RemoveRange(radiusDbContext.Radcheck);
            radiusDbContext.RemoveRange(radiusDbContext.Radgroupcheck);
            radiusDbContext.RemoveRange(radiusDbContext.Radgroupreply);
            radiusDbContext.RemoveRange(radiusDbContext.Radippool);

            context.SaveChanges();
            radiusDbContext.SaveChanges();
        }
コード例 #2
0
        public void CreateDataCase17()
        {
            CreateBaseData();

            var simAndDeviceAuthenticated = new SimAndDeviceAuthenticated()
            {
                SimAndDevice = SimAndDevice1,
                Expiration   = CurrentDateTimeForLessThanStart.Item2
            };

            MainDbContext.AddRange(simAndDeviceAuthenticated);
            SimAndDevice1.SimAndDeviceAuthenticated = simAndDeviceAuthenticated;

            var multiFactorAuthenticated = new MultiFactorAuthenticated()
            {
                MultiFactor = MultiFactor1,
                Expiration  = CurrentDateTimeForLessThanStart.Item2
            };

            MainDbContext.AddRange(multiFactorAuthenticated);
            MultiFactor1.MultiFactorAuthenticated = multiFactorAuthenticated;

            MainDbContext.SaveChanges();
            RadiusDbContext.SaveChanges();
        }
        public void SetUpInsertDataForCase02()
        {
            SetUpInsertBaseDataForDeauthenticationRadiusDb();

            MainDbContext.SaveChanges();
            RadiusDbContext.SaveChanges();
        }
コード例 #4
0
 public void CreateDataCase04()
 {
     CreateBaseData();
     Organization.StartDate = CurrentDateTimeForStart.Item2; // '実行日より未来
     MainDbContext.SaveChanges();
     RadiusDbContext.SaveChanges();
 }
コード例 #5
0
 public void CreateDataCase08()
 {
     CreateBaseData();
     Organization.StartDate = CurrentDateTimeForEnd.Item1; // '実行日より過去
     Organization.EndDate   = CurrentDateTimeForEnd.Item1; // '実行日より過去
     MainDbContext.SaveChanges();
     RadiusDbContext.SaveChanges();
 }
コード例 #6
0
 public void CreateDataCase06()
 {
     CreateBaseData();
     Organization.StartDate       = CurrentDateTimeForStart.Item1; // '実行日と同日
     Organization.EndDate         = CurrentDateTimeForStart.Item2; // '実行日より未来
     SimGroup1.IsolatedNw1IpRange = "192.168.1.128/32";            // '有効ホストIP数=1個 サブネット=32bit
     MainDbContext.SaveChanges();
     RadiusDbContext.SaveChanges();                                // radiusのデータなし
 }
        //public void SetUpInsertDataForCase03()
        //{
        //    SetUpInsertBaseDataForDeauthenticationRadiusDb();

        //    MainDbContext.SaveChanges();
        //    RadiusDbContext.SaveChanges();
        //}

        //public void SetUpInsertDataForCase04()
        //{
        //    SetUpInsertBaseDataForDeauthenticationRadiusDb();

        //    MainDbContext.SaveChanges();
        //    RadiusDbContext.SaveChanges();
        //}

        //public void SetUpInsertDataForCase05()
        //{
        //    var (simAndDevice, _, _) = InsertSimDevice(CurrentDateTimeForEnd, true);
        //    simAndDevice.SimAndDeviceAuthenticated.Id = Guid.NewGuid();

        //    SetUpInsertBaseDataForDeauthenticationRadiusDb();

        //    MainDbContext.SaveChanges();
        //    RadiusDbContext.SaveChanges();
        //}

        public void SetUpInsertDataForCase06()
        {
            var(simDevice, _, _) = InsertSimDevice(CurrentDateTimeForEnd, true);
            simDevice.SimAndDeviceAuthenticated.Id = Guid.Parse("0e4e88ae-c880-11e2-8598-5855cafa776a");

            SetUpInsertBaseDataForDeauthenticationRadiusDb();

            MainDbContext.SaveChanges();
            RadiusDbContext.SaveChanges();
        }
        public void SetUpInsertBaseDataForDeauthenticationRadiusDb()
        {
            //base.SetUpInsertBaseDataForRadiusDb();

            RadiusDbContext.SaveChanges();
            var radreply = RadiusDbContext.Radreply.Where(r => r.Username == "user1@jincreek2" && r.Attribute == "Framed-IP-Address").Single();

            RadiusDbContext.SaveChanges();
            radreply.Value = "NwAddress";
        }
コード例 #9
0
 public void CreateDataCase05()
 {
     CreateBaseData();
     Organization.StartDate = CurrentDateTimeForStart.Item1; // '実行日と同日
     Organization.EndDate   = CurrentDateTimeForStart.Item1; // '実行日と同日
     MainDbContext.SaveChanges();
     MainDbContext.RemoveRange(MainDbContext.Sim);
     MainDbContext.RemoveRange(MainDbContext.SimGroup); // sim と SimGroupない
     MainDbContext.SaveChanges();
     SetDataForNotSim();
     SetDataForNotSimGroup();
     RadiusDbContext.SaveChanges();
 }
        public void SetUpInsertDataForCase08()
        {
            var(simDevice, _, _) = InsertSimDevice(CurrentDateTimeForEnd, true);
            simDevice.SimAndDeviceAuthenticated.Id = Guid.Parse("0e4e88ae-c880-11e2-8598-5855cafa776a");

            SetUpInsertFactorCombinationAndEndUser(simDevice, "AdminAccount", "AccountUser1",
                                                   CurrentDateTimeForEnd, CurrentDateTimeForEnd);

            SetUpInsertBaseDataForDeauthenticationRadiusDb();

            MainDbContext.SaveChanges();
            RadiusDbContext.SaveChanges();
        }
コード例 #11
0
 public void CreateDataCase07()
 {
     CreateBaseData();
     Organization.Code      = 5;
     Organization.StartDate = CurrentDateTimeForStart.Item1; // '実行日と同日
     Organization.EndDate   = null;                          // 不在
     //Ad-Domain-2-3-5
     //JinCreek-Domain-3-5-6
     SetDataDeviceGroup06();
     SetDataUserGroup06();
     MainDbContext.SaveChanges();
     RadiusDbContext.SaveChanges();
 }
コード例 #12
0
        private void SetUpInsertBaseDataForRadiusDb()
        {
            var radreply = new Radreply
            {
                Username  = "******",
                Op        = "=",
                Attribute = "RadreplyAttribute1",
                Value     = "Nw1Address"
            };

            _radiusDbContext.Radreply.Add(radreply);
            _radiusDbContext.SaveChanges();
        }
コード例 #13
0
        public void CreateDataCase10()
        {
            CreateBaseData();

            var simAndDeviceAuthenticated = new SimAndDeviceAuthenticated()
            {
                SimAndDevice = SimAndDevice1,
                Expiration   = CurrentDateTimeForEnd.Item2
            };

            MainDbContext.AddRange(simAndDeviceAuthenticated);
            SimAndDevice1.SimAndDeviceAuthenticated = simAndDeviceAuthenticated;

            MainDbContext.SaveChanges();
            RadiusDbContext.SaveChanges();
        }
コード例 #14
0
        public void CreateDataCase04()
        {
            CreateBaseData();

            var multiFactorAuthenticated = new MultiFactorAuthenticated()
            {
                MultiFactor = MultiFactor1,
                Expiration  = CurrentDateTimeForEnd.Item2
            };

            MainDbContext.AddRange(multiFactorAuthenticated);
            MultiFactor1.MultiFactorAuthenticated = multiFactorAuthenticated;

            MainDbContext.SaveChanges();
            RadiusDbContext.SaveChanges();
        }
コード例 #15
0
 public void CreateDataCase02()
 {
     MainDbContext.SaveChanges();
     RadiusDbContext.SaveChanges();
 }
コード例 #16
0
 public void CreateDataCase03()
 {
     CreateBaseData();
     MainDbContext.SaveChanges();
     RadiusDbContext.SaveChanges();
 }
コード例 #17
0
        public void CreateDataCase09()
        {
            CreateBaseData();
            Organization.StartDate       = CurrentDateTimeForEnd.Item1;   // '実行日より過去
            Organization.EndDate         = CurrentDateTimeForStart.Item1; // '実行日と同日
            SimGroup1.IsolatedNw1IpRange = "192.168.1.0/30";              // '有効ホストIP数=2個(サブネット = 30bit)※NIP最小アドレス
            var radgroupcheck1 = new Radgroupcheck()                      // SimGroupいるの Radgroupcheck Radgroupreply
            {
                Attribute = "Pool-Name",
                Groupname = SimGroup1.Id.ToString(),
                Op        = ":=",
                Value     = SimGroup1.IsolatedNw1IpPool
            };
            var radgroupcheck2 = new Radgroupcheck()
            {
                Attribute = "Called-Station-Id",
                Groupname = SimGroup1.Id.ToString(),
                Op        = "==",
                Value     = SimGroup1.Apn
            };
            var radgroupcheck3 = new Radgroupcheck()
            {
                Attribute = "NAS-IP-Address",
                Groupname = SimGroup1.Id.ToString(),
                Op        = "==",
                Value     = SimGroup1.NasIp
            };
            var radgroupreply1 = new Radgroupreply()
            {
                Attribute = "MS-Primary-DNS-Server",
                Groupname = SimGroup1.Id.ToString(),
                Op        = ":=",
                Value     = SimGroup1.PrimaryDns
            };
            var radgroupreply2 = new Radgroupreply()
            {
                Attribute = "MS-Secondary-DNS-Server",
                Groupname = SimGroup1.Id.ToString(),
                Op        = ":=",
                Value     = SimGroup1.SecondaryDns
            };
            var radcheck1 = new Radcheck()  // SimいるのRadcheckとRadusergroup
            {
                Username  = Sim1.UserName + "@" + Sim1.SimGroup.UserNameSuffix,
                Attribute = "Cleartext-Password",
                Op        = ":=",
                Value     = Sim1.Password
            };
            var radcheck2 = new Radcheck()
            {
                Username  = Sim1.UserName + "@" + Sim1.SimGroup.UserNameSuffix,
                Attribute = "Calling-Station-Id",
                Op        = "==",
                Value     = Sim1.Msisdn
            };
            var radusergroup = new Radusergroup()
            {
                Username  = Sim1.UserName + "@" + Sim1.SimGroup.UserNameSuffix,
                Groupname = Sim1.SimGroup.Id.ToString()
            };
            var radippool = new Radippool()
            {
                Framedipaddress  = "192.168.1.1", //'Simgroup1のCIDR別有効ホストIP範囲に含まれる
                Nasipaddress     = "",
                Calledstationid  = "",
                Callingstationid = "",
                Username         = "",
                Poolkey          = "",
                PoolName         = SimGroup1.IsolatedNw1IpPool
            };
            var radippool2 = new Radippool()
            {
                Framedipaddress  = "192.168.1.100", //'Simgroup1のCIDR別有効ホストIP範囲に含まれない
                Nasipaddress     = "",
                Calledstationid  = "",
                Callingstationid = "",
                Username         = "",
                Poolkey          = "",
                PoolName         = SimGroup1.IsolatedNw1IpPool
            };

            SetDataForNotSim();
            RadiusDbContext.AddRange(radgroupcheck1, radgroupcheck2, radgroupcheck3, radgroupreply1, radgroupreply2,
                                     radcheck1, radcheck2, radusergroup, radippool, radippool2);

            MainDbContext.Sim.Add(new Sim()
            {
                Msisdn   = "111111111",
                Imsi     = "11111111111",
                IccId    = "1111111111",
                UserName = "******",
                Password = "******",
                SimGroup = SimGroup1
            });
            MainDbContext.SaveChanges();
            RadiusDbContext.SaveChanges();
        }
コード例 #18
0
        public void CreateDataCase07()
        {
            CreateBaseData();
            Organization.StartDate       = CurrentDateTimeForStart.Item1; // '実行日と同日
            Organization.EndDate         = null;                          // 不在
            SimGroup1.IsolatedNw1IpRange = "192.168.1.128/32";            // '有効ホストIP数=1個 サブネット=32bit
            var simGroup2 = new SimGroup()
            {
                Organization           = Organization,
                Name                   = "SimGroup2",
                Apn                    = "apn.example.com",
                NasIp                  = "192.168.0.2",
                IsolatedNw1IpPool      = "ip_pool_2",
                IsolatedNw1IpRange     = "192.168.1.255/30", // '有効ホストIP数=2個 サブネット=30bit)※NIP最大(要補正)アドレス
                AuthenticationServerIp = "172.16.0.1",
                PrimaryDns             = "192.168.0.2",
                SecondaryDns           = "192.168.0.3",
                UserNameSuffix         = "jincreek2"
            };
            var simGroup3 = new SimGroup()
            {
                Organization           = Organization,
                Name                   = "SimGroup3",
                Apn                    = "apn.example.com",
                NasIp                  = "192.168.0.2",
                IsolatedNw1IpPool      = "ip_pool_3",
                IsolatedNw1IpRange     = "192.168.1.64/31", // '有効ホストIP数=0個(サブネット = 31bit)
                AuthenticationServerIp = "172.16.0.1",
                PrimaryDns             = "192.168.0.2",
                SecondaryDns           = "192.168.0.3",
                UserNameSuffix         = "jincreek3"
            };

            MainDbContext.Sim.Add(new Sim() // sim_1
            {
                Msisdn   = "111111112",
                Imsi     = "11111111112",
                IccId    = "1111111112",
                UserName = "******",
                Password = "******",
                SimGroup = SimGroup1
            });
            var sim2 = new Sim() // sim_2
            {
                Msisdn   = "111111113",
                Imsi     = "11111111113",
                IccId    = "1111111113",
                UserName = "******",
                Password = "******",
                SimGroup = simGroup2
            };

            RadiusDbContext.Radcheck.Add(new Radcheck()  // SimいるのRadcheckとRadusergroup
            {
                Username  = sim2.UserName + "@" + sim2.SimGroup.UserNameSuffix,
                Attribute = "Cleartext-Password",
                Op        = ":=",
                Value     = sim2.Password
            });
            RadiusDbContext.Radcheck.Add(new Radcheck()
            {
                Username  = sim2.UserName + "@" + sim2.SimGroup.UserNameSuffix,
                Attribute = "Calling-Station-Id",
                Op        = "==",
                Value     = Sim1.Msisdn
            });
            RadiusDbContext.Radusergroup.Add(new Radusergroup()
            {
                Username  = sim2.UserName + "@" + sim2.SimGroup.UserNameSuffix,
                Groupname = sim2.SimGroup.Id.ToString(),
            });
            RadiusDbContext.Radippool.Add(new Radippool()
            {
                Framedipaddress  = "192.168.1.100", //'simGroup3のCIDR別有効ホストIP範囲に含まれない
                Nasipaddress     = "",
                Calledstationid  = "",
                Callingstationid = "",
                Username         = "",
                Poolkey          = "",
                PoolName         = simGroup3.IsolatedNw1IpPool
            });
            SetDataForNotSimGroup();
            MainDbContext.SaveChanges();
            RadiusDbContext.SaveChanges();
        }