Beispiel #1
0
        public virtual void TestCreateRemoteUser()
        {
            UserGroupInformation ugi = UserGroupInformation.CreateRemoteUser("user1");

            Assert.Equal(UserGroupInformation.AuthenticationMethod.Simple,
                         ugi.GetAuthenticationMethod());
            Assert.True(ugi.ToString().Contains("(auth:SIMPLE)"));
            ugi = UserGroupInformation.CreateRemoteUser("user1", SaslRpcServer.AuthMethod.Kerberos
                                                        );
            Assert.Equal(UserGroupInformation.AuthenticationMethod.Kerberos
                         , ugi.GetAuthenticationMethod());
            Assert.True(ugi.ToString().Contains("(auth:KERBEROS)"));
        }
Beispiel #2
0
        public virtual void TestCreateProxyUser()
        {
            // ensure that doAs works correctly
            UserGroupInformation realUserUgi = UserGroupInformation.CreateRemoteUser(RealUserName
                                                                                     );
            UserGroupInformation proxyUserUgi = UserGroupInformation.CreateProxyUser(ProxyUserName
                                                                                     , realUserUgi);
            UserGroupInformation curUGI = proxyUserUgi.DoAs(new _PrivilegedExceptionAction_122
                                                                ());

            Assert.Equal(ProxyUserName + " (auth:PROXY) via " + RealUserName
                         + " (auth:SIMPLE)", curUGI.ToString());
        }
Beispiel #3
0
            public override string ToString()
            {
                if (ugi == null)
                {
                    return("(null ugi)");
                }
                StringBuilder builder = new StringBuilder();

                builder.Append(ugi.GetUserName()).Append(": ");
                builder.Append(ugi.ToString());
                builder.Append(" hasKerberosCredentials=").Append(ugi.HasKerberosCredentials());
                builder.Append(" isFromKeytab=").Append(ugi.IsFromKeytab());
                builder.Append(" kerberos is enabled in Hadoop =").Append(UserGroupInformation.IsSecurityEnabled
                                                                              ());
                return(builder.ToString());
            }