Exemple #1
0
        public virtual void TestAuthenticationAnonymousDisallowed()
        {
            AuthenticatorTestCase auth = new AuthenticatorTestCase();

            AuthenticatorTestCase.SetAuthenticationHandlerConfig(GetAuthenticationHandlerConfiguration
                                                                     (false));
            auth._testAuthentication(new PseudoAuthenticator(), false);
        }
Exemple #2
0
        public virtual void TestAuthenticationAnonymousAllowedWithPost()
        {
            AuthenticatorTestCase auth = new AuthenticatorTestCase();

            AuthenticatorTestCase.SetAuthenticationHandlerConfig(GetAuthenticationHandlerConfiguration
                                                                     (true));
            auth._testAuthentication(new PseudoAuthenticator(), true);
        }
        /// <exception cref="System.Exception"/>
        public virtual void TestAuthenticationHttpClientPost()
        {
            AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);

            AuthenticatorTestCase.SetAuthenticationHandlerConfig(GetAuthenticationHandlerConfiguration
                                                                     ());
            KerberosTestUtils.DoAsClient(new _Callable_157(auth));
        }
        /// <exception cref="System.Exception"/>
        public virtual void TestFallbacktoPseudoAuthenticatorAnonymous()
        {
            AuthenticatorTestCase auth  = new AuthenticatorTestCase(useTomcat);
            Properties            props = new Properties();

            props.SetProperty(AuthenticationFilter.AuthType, "simple");
            props.SetProperty(PseudoAuthenticationHandler.AnonymousAllowed, "true");
            AuthenticatorTestCase.SetAuthenticationHandlerConfig(props);
            auth._testAuthentication(new KerberosAuthenticator(), false);
        }
Exemple #5
0
        public virtual void TestAnonymousAllowed()
        {
            AuthenticatorTestCase auth = new AuthenticatorTestCase();

            AuthenticatorTestCase.SetAuthenticationHandlerConfig(GetAuthenticationHandlerConfiguration
                                                                     (true));
            auth.Start();
            try
            {
                Uri url = new Uri(auth.GetBaseURL());
                HttpURLConnection conn = (HttpURLConnection)url.OpenConnection();
                conn.Connect();
                Assert.Equal(HttpURLConnection.HttpOk, conn.GetResponseCode());
            }
            finally
            {
                auth.Stop();
            }
        }
        /// <exception cref="System.Exception"/>
        public virtual void TestNotAuthenticated()
        {
            AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);

            AuthenticatorTestCase.SetAuthenticationHandlerConfig(GetAuthenticationHandlerConfiguration
                                                                     ());
            auth.Start();
            try
            {
                Uri url = new Uri(auth.GetBaseURL());
                HttpURLConnection conn = (HttpURLConnection)url.OpenConnection();
                conn.Connect();
                Assert.Equal(HttpURLConnection.HttpUnauthorized, conn.GetResponseCode
                                 ());
                Assert.True(conn.GetHeaderField(KerberosAuthenticator.WwwAuthenticate
                                                ) != null);
            }
            finally
            {
                auth.Stop();
            }
        }
Exemple #7
0
        public virtual void TestAnonymousDisallowed()
        {
            AuthenticatorTestCase auth = new AuthenticatorTestCase();

            AuthenticatorTestCase.SetAuthenticationHandlerConfig(GetAuthenticationHandlerConfiguration
                                                                     (false));
            auth.Start();
            try
            {
                Uri url = new Uri(auth.GetBaseURL());
                HttpURLConnection conn = (HttpURLConnection)url.OpenConnection();
                conn.Connect();
                Assert.Equal(HttpURLConnection.HttpUnauthorized, conn.GetResponseCode
                                 ());
                Assert.True(conn.GetHeaderFields().Contains("WWW-Authenticate")
                            );
                Assert.Equal("Authentication required", conn.GetResponseMessage
                                 ());
            }
            finally
            {
                auth.Stop();
            }
        }
 public _Callable_157(AuthenticatorTestCase auth)
 {
     this.auth = auth;
 }