我的网站的一部分只能由经过身份验证的用户访问.我想知道这些网页是否被谷歌抓取,或者它们对搜索引擎有点"隐藏".
谢谢
我试图调用一个具有基本HTTP身份验证的Web服务.我使用AXIS的WSDL2JAVA工具生成了客户端代码.
但是我无法为webservice调用设置用户名和密码.
我试着把它们放在端点url中
但是我收到了未经授权的错误.我试图找到一种方法来将此设置用于Java代码中的调用....
注意:我可以通过soapUI调用相同的服务并获得结果.我在请求的"自动"选项卡中提供了用户名和密码.
以下是我的Stub的一些代码片段,如果这对您有用
_serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service);
_serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(
targetEndpoint));
_serviceClient.getOptions().setUseSeparateListener(useSeparateListener);
//adding SOAP soap_headers
_serviceClient.addHeadersToEnvelope(env);
// set the message context with that soap envelope
_messageContext.setEnvelope(env);
// add the message contxt to the operation client
_operationClient.addMessageContext(_messageContext);
//execute the operation client
_operationClient.execute(true);
Run Code Online (Sandbox Code Playgroud)
任何投入将不胜感激!!
如何读取请求HTTP基本身份验证的服务器在WWW-Authenticate标头中发送的Realm属性?
我在发布到受基本访问身份验证保护的资源时遇到问题。这是代码,我正在使用@mikeal的请求:
request.post({
uri: "http://user:password@mysite.com/resource",
json: {
"id": "1",
"par1": "a",
"par2": "b"
}
}, function (error, response, body) {
console.log(error);
console.log(response);
console.log(body);
});
Run Code Online (Sandbox Code Playgroud)
我有{ [Error: Parse Error] bytesParsed: 0 }错误,undefined反应和身体都有。如果删除“ user:password”部分,则可以正确获取401 HTTP Basic:访问被拒绝。
您是否知道像我这样是否有办法将JSON发布到受保护的资源?如果不是这样,我相信我将不得不采用http模块的方式,但是我将其保留为最终资源,因为它更加冗长。
更新:为了使操作尽可能简单,我将该文件移动到了新目录中并做了一个npm install request。问题消失了,我检查了来自哪里byteParsed,发现它在Express要求的“可编排”中,而我在运行此测试的目录中有此文件。现在有点困惑。
我正在使用基本身份验证开发一个安静的Web服务.在web xml中我有以下内容:
<security-constraint>
<web-resource-collection>
<web-resource-name>Services</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>User</role-name>
</auth-constraint>
</security-constraint>
<session-config>
<session-timeout>1</session-timeout>
</session-config>
Run Code Online (Sandbox Code Playgroud)
这按预期工作:用户在与服务交互时必须提供密码.
但是,为了符合更多RESTful标准,我认为它应该是一个永远不会创建会话的无状态服务.换句话说,我想强制客户端为每个请求提供凭据.
如果我在web-xml中将session-timeout设置为0,则会将其解释为"never expire",这与我想要的完全相反.
是否有一种简单的方法可以使会话立即失效?
这就是我用curl做这个http请求的方法
curl -v --basic --user USERNAME:PASSWORD
如何将其设置为不同REST客户端中的标头?
我可以在php中创建curl命令,但在其他基于GUI的休息客户端中,我不确定其余部分"基本身份验证"真正属于哪个部分,是否在体内?在标题结构中的某种方式?感谢您的见解
我有一个受基本HTTP身份验证保护的目录.
当我访问其URL时,浏览器会要求我输入用户名和密码.
我的密码是Cw=y?qUPP+Xy,它工作正常.
但是,我想直接使用URL上的用户名和密码访问它.
我试过这个:
https://user:Cw=y?qUPP+Xy@example.com,它没有用,由于某种原因谷歌chrome返回这个:

有解决方法吗?
当试图从github apir获取数据时,我得到了403.我想使用基本身份验证(用户名和密码).
我也尝试过没有凭据缓存并直接设置凭据,结果相同.
我究竟做错了什么?
string url = "https://api.github.com/search/users?q=gentlehag"
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
request.Method = "GET";
request.Proxy = null;
request.PreAuthenticate = true;
var crds = new NetworkCredential(Username, Password);
CredentialCache myCredentialCache = new CredentialCache();
myCredentialCache.Add(new Uri(url), "Basic", crds);
request.Credentials = myCredentialCache;
request.KeepAlive = false;
request.Accept = "application/vnd.github.v" + Version + "+json";
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
return reader.ReadToEnd();
}
}
Run Code Online (Sandbox Code Playgroud)
我也尝试在这样的hider中设置基本身份验证
request.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(Username + ":" + …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用POST请求插入数据,但出现403错误。使用GET时,基本身份验证有效。为了进行测试,我使用了Fiddler。
有什么问题?
安全配置:
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/**").hasRole("USER").and()
.httpBasic();
}
@Override
protected void configure(AuthenticationManagerBuilder auth)
throws Exception {
auth
.inMemoryAuthentication()
.withUser("user")
.password("password")
.roles("USER");
}
}
Run Code Online (Sandbox Code Playgroud)
请求-POST:
User-Agent: Fiddler
Host: localhost:8080
Content-Length: 200
Content-Type: application/json
Authorization: Basic dXNlcjpwYXNzd29yZA==
Run Code Online (Sandbox Code Playgroud)
要求正文:
{"name" : "name1",
"description" : "desc1"}
Run Code Online (Sandbox Code Playgroud) java spring spring-security basic-authentication spring-boot
如何使用Golang站点实现基本身份验证?因此,当有人访问某个页面时,他们的浏览器会通过登录提示他们.