コード例 #1
0
            /// <exception cref="Apache.Http.HttpException"></exception>
            /// <exception cref="System.IO.IOException"></exception>
            public void Process(HttpWebRequest request, HttpContext context)
            {
                AuthState authState = (AuthState)context.GetAttribute(ClientContext.TargetAuthState
                                                                      );

                if (authState.GetAuthScheme() == null)
                {
                    authState.SetAuthScheme(new BasicScheme());
                    authState.SetCredentials(credentials);
                }
            }
コード例 #2
0
            /// <exception cref="Apache.Http.HttpException"></exception>
            /// <exception cref="System.IO.IOException"></exception>
            public void Process(HttpWebRequest request, HttpContext context)
            {
                AuthState authState = (AuthState)context.GetAttribute(ClientContext.TargetAuthState
                                                                      );
                CredentialsProvider credsProvider = (CredentialsProvider)context.GetAttribute(ClientContext
                                                                                              .CredsProvider);
                HttpHost targetHost = (HttpHost)context.GetAttribute(ExecutionContext.HttpTargetHost
                                                                     );

                if (authState.GetAuthScheme() == null)
                {
                    AuthScope authScope = new AuthScope(targetHost.GetHostName(), targetHost.GetPort(
                                                            ));
                    authState.SetAuthScheme(new BasicScheme());
                    authState.SetCredentials(creds);
                }
            }