JIRA集成
可用于将第三方应用程序与jira 4.3集成的身份验证方案有哪些。显然,从客户那里获取用户名和密码听起来很荒谬。此外,我还了解到oauth身份验证仅在版本5中可用。请让我知道。谢谢JIRA集成,jira,Jira,可用于将第三方应用程序与jira 4.3集成的身份验证方案有哪些。显然,从客户那里获取用户名和密码听起来很荒谬。此外,我还了解到oauth身份验证仅在版本5中可用。请让我知道。谢谢 另外,我不想开发插件或使用rest版本5。我只是尝试使用RESTAPI版本4.4.1从jira中提取数据 您始终可以只使用一个登录名(例如匿名用户)在后台与Jira连接,而无需向用户询问密码。 你也可以。 或设置项目。如果是本地Jira(安装在您的系统上),您可以调用任何客户端API来提取数据,只需提供url和编码的
另外,我不想开发插件或使用rest版本5。我只是尝试使用RESTAPI版本4.4.1从jira中提取数据 您始终可以只使用一个登录名(例如匿名用户)在后台与Jira连接,而无需向用户询问密码。 你也可以。 或设置项目。如果是本地Jira(安装在您的系统上),您可以调用任何客户端API来提取数据,只需提供url和编码的身份验证(带有用户名和密码) 。。。 但如果它是SSL/https安全的,那么您需要使用truststore、keystore、keyStorePassword等设置系统属性(如果使用Java作为技术)。您可以使用API JiraRestClientFactory创建jira客户端,如下所示
public JiraRestClient getRestClient() {
System.setProperty("javax.net.ssl.trustStore", Constants.KEYSTORE);
System.setProperty("javax.net.ssl.keyStore", Constants.KEYSTORE);
System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
String trustStore = System.getProperty("javax.net.ssl.trustStore");
System.setProperty("-Dlog4j.configuration", "log4j.properties");
if (trustStore == null) {
Constants.REPORT.info("javax.net.ssl.trustStore is not defined, Please generate \"KeyStore.jks\" of JIRA Instance");
}
final JiraRestClientFactory jiraRestClientFactory = new AsynchronousJiraRestClientFactory();
final HttpClientOptions options = new HttpClientOptions();
options.setConnectionTimeout(15, TimeUnit.MINUTES);
options.setSocketTimeout(15, TimeUnit.MINUTES);
options.setConnectionPoolTimeToLive(15, TimeUnit.MINUTES);
options.setRequestPreparer(new Effect<Request>() {
@Override
public void apply(final Request request) {
new BasicHttpAuthenticationHandler(applicationProperties.getJiraUser().trim(), applicationProperties.getJiraPassword().trim()).configure(request);
}
});
try {
URI serverUri = new URI(applicationProperties.getjURL().trim());
defaultHttpClient = new DefaultHttpClient<>(new NoOpEventPublisher(), new RestClientApplicationProperties(serverUri), ThreadLocalContextManagers.noop(), options);
return jiraRestClientFactory.create(serverUri, defaultHttpClient);
} catch (Exception e) {
String msg = "Terminating the application while connecting to RestClient : " + e.getMessage();
Constants.REPORT.info("javax.net.ssl.trustStore is not defined, Please generate \"KeyStore.jks\" of JIRA Instance");
Constants.REPORT.info(msg);
Constants.ERROR.info(msg);
Constants.ERROR.info(Level.SEVERE, e);
System.exit(-1);
}
return null;
}
publicjirarestclient getRestClient(){
setProperty(“javax.net.ssl.trustStore”,Constants.KEYSTORE);
setProperty(“javax.net.ssl.keyStore”,Constants.keyStore);
setProperty(“javax.net.ssl.keystrepassword”、“changeit”);
字符串trustStore=System.getProperty(“javax.net.ssl.trustStore”);
System.setProperty(“-Dlog4j.configuration”、“log4j.properties”);
if(信任库==null){
Constants.REPORT.info(“javax.net.ssl.trustStore未定义,请生成JIRA实例的\“KeyStore.jks\”);
}
final JiraRestClientFactory JiraRestClientFactory=new AsynchronousJiraRestClientFactory();
最终HttpClientOptions选项=新的HttpClientOptions();
选项。setConnectionTimeout(15,时间单位:分钟);
选项。setSocketTimeout(15,时间单位:分钟);
选项。setConnectionPoolTimeToLive(15,时间单位:分钟);
options.setRequestPreparer(新效果(){
@凌驾
公共无效申请(最终申请){
新的BasicHttpAuthenticationHandler(applicationProperties.getJiraUser().trim(),applicationProperties.getJiraPassword().trim())。配置(请求);
}
});
试一试{
URI serverUri=新URI(applicationProperties.getjURL().trim());
defaultHttpClient=新的defaultHttpClient(新的NoopeEventPublisher()、新的RestClientApplicationProperties(serverUri)、ThreadLocalContextManager.noop()、options);
返回jiraRestClientFactory.create(serverUri,defaultHttpClient);
}捕获(例外e){
String msg=“连接到RestClient时终止应用程序:”+e.getMessage();
Constants.REPORT.info(“javax.net.ssl.trustStore未定义,请生成JIRA实例的\“KeyStore.jks\”);
常量.REPORT.info(msg);
常量.ERROR.info(msg);
常数.错误.信息(严重等级e);
系统退出(-1);
}
返回null;
}
public JiraRestClient getRestClient() {
System.setProperty("javax.net.ssl.trustStore", Constants.KEYSTORE);
System.setProperty("javax.net.ssl.keyStore", Constants.KEYSTORE);
System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
String trustStore = System.getProperty("javax.net.ssl.trustStore");
System.setProperty("-Dlog4j.configuration", "log4j.properties");
if (trustStore == null) {
Constants.REPORT.info("javax.net.ssl.trustStore is not defined, Please generate \"KeyStore.jks\" of JIRA Instance");
}
final JiraRestClientFactory jiraRestClientFactory = new AsynchronousJiraRestClientFactory();
final HttpClientOptions options = new HttpClientOptions();
options.setConnectionTimeout(15, TimeUnit.MINUTES);
options.setSocketTimeout(15, TimeUnit.MINUTES);
options.setConnectionPoolTimeToLive(15, TimeUnit.MINUTES);
options.setRequestPreparer(new Effect<Request>() {
@Override
public void apply(final Request request) {
new BasicHttpAuthenticationHandler(applicationProperties.getJiraUser().trim(), applicationProperties.getJiraPassword().trim()).configure(request);
}
});
try {
URI serverUri = new URI(applicationProperties.getjURL().trim());
defaultHttpClient = new DefaultHttpClient<>(new NoOpEventPublisher(), new RestClientApplicationProperties(serverUri), ThreadLocalContextManagers.noop(), options);
return jiraRestClientFactory.create(serverUri, defaultHttpClient);
} catch (Exception e) {
String msg = "Terminating the application while connecting to RestClient : " + e.getMessage();
Constants.REPORT.info("javax.net.ssl.trustStore is not defined, Please generate \"KeyStore.jks\" of JIRA Instance");
Constants.REPORT.info(msg);
Constants.ERROR.info(msg);
Constants.ERROR.info(Level.SEVERE, e);
System.exit(-1);
}
return null;
}