Example #1
0
        public virtual void TestWithDuplicateProxyHosts()
        {
            Configuration conf = new Configuration();

            conf.Set(DefaultImpersonationProvider.GetTestProvider().GetProxySuperuserGroupConfKey
                         (RealUserName), StringUtils.Join(",", Arrays.AsList(GroupNames)));
            conf.Set(DefaultImpersonationProvider.GetTestProvider().GetProxySuperuserIpConfKey
                         (RealUserName), StringUtils.Join(",", Arrays.AsList(ProxyIp, ProxyIp)));
            ProxyUsers.RefreshSuperUserGroupsConfiguration(conf);
            ICollection <string> hosts = ProxyUsers.GetDefaultImpersonationProvider().GetProxyHosts
                                             ()[DefaultImpersonationProvider.GetTestProvider().GetProxySuperuserIpConfKey(RealUserName
                                                                                                                          )];

            Assert.Equal(1, hosts.Count);
        }
Example #2
0
        public virtual void TestWithProxyGroupsAndUsersWithSpaces()
        {
            Configuration conf = new Configuration();

            conf.Set(DefaultImpersonationProvider.GetTestProvider().GetProxySuperuserUserConfKey
                         (RealUserName), StringUtils.Join(",", Arrays.AsList(ProxyUserName + " ", AuthorizedProxyUserName
                                                                             , "ONEMORE")));
            conf.Set(DefaultImpersonationProvider.GetTestProvider().GetProxySuperuserGroupConfKey
                         (RealUserName), StringUtils.Join(",", Arrays.AsList(GroupNames)));
            conf.Set(DefaultImpersonationProvider.GetTestProvider().GetProxySuperuserIpConfKey
                         (RealUserName), ProxyIp);
            ProxyUsers.RefreshSuperUserGroupsConfiguration(conf);
            ICollection <string> groupsToBeProxied = ProxyUsers.GetDefaultImpersonationProvider
                                                         ().GetProxyGroups()[DefaultImpersonationProvider.GetTestProvider().GetProxySuperuserGroupConfKey
                                                                                 (RealUserName)];

            Assert.Equal(GroupNames.Length, groupsToBeProxied.Count);
        }