本文介绍了凭据的ActiveMQ /椒/ HawtIO通过Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道5.9.0的HawtIO /椒默认密码是在\\的conf \\文件夹内,是

I know the default password for 5.9.0's HawtIO/Jolokia is set in the \conf\ folder and is

管理员/管理员
system / manager身份
等等

admin/adminsystem/manageretc

不过,这些都不密码正在试图通过Java来执行命令宁静时:

However, none of those password are working when trying to execute the restful commands through Java:

CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(new AuthScope(null, -80), new UsernamePasswordCredentials("admin", "admin"));
CloseableHttpClient httpclient0 = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build();
URI uri0 = URI.create("http://localhost:8161/hawtio/auth/login/");
HttpGet httpget = new HttpGet(uri0);
HttpResponse r0 = httpclient0.execute(httpget);
System.out.println("Login form get: " + r0.getStatusLine());
for (Header h : r0.getAllHeaders())
  System.out.println(h.getName() + "/" + h.getValue());
HttpEntity entity = r0.getEntity();

InputStream is0 = entity.getContent();
String resp = IOUtils.toString(is0);
System.out.println("Response0: " + resp);

以下code刚刚吐出回403禁止回复!我尝试过的用户名和密码的多种组合。

The following code just spits back a 403 Forbidden reply! I've tried many combinations of username and passwords.

Login form get: HTTP/1.1 403 Forbidden
Access-Control-Allow-Origin/*
Content-Length/0
Server/Jetty(7.6.9.v20130131)

什么在这里工作?

What works here?

我记得运行5.8.0时为admin / admin的工作,但我想用5.9.0代替。这将是瘸子背出这个版本仅仅是因为用户名和密码已更改。

I recall when running 5.8.0 that "admin/admin" worked, but I'd like to use 5.9.0 instead. It would be lame to back out of this version just because the username and password changed.

此外,该\\ CONF文件规定此密码......?

Further, which \conf file dictates this password...?

推荐答案

您已经几乎得到了它,你只需要张贴到该网址,而不是做一个GET的。而你只需设置在授权头您的用户名/密码。在hawtio认证过滤器避免发送回401,使浏览器认​​证提示出现,因此为什么你看不到401,而不是返回

you've almost got it, you just need to POST to that URL instead of doing a GET. And you just set your username/password in the Authorization header. The authentication filter in hawtio avoids sending back a 401 as that makes the browser authentication prompt appear, hence why you don't see 401 returned instead.

这篇关于凭据的ActiveMQ /椒/ HawtIO通过Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 14:12