use of org.codelibs.fess.crawler.exception.CrawlerSystemException in project fess by codelibs.
the class DataConfig method getCredentials.
private Credentials getCredentials(final String webAuthName, final String scheme, final Map<String, String> paramMap) {
final String username = paramMap.get(CRAWLER_WEB_AUTH + "." + webAuthName + ".username");
if (StringUtil.isEmpty(username)) {
throw new CrawlerSystemException("username is empty. webAuth:" + webAuthName);
}
final String password = paramMap.get(CRAWLER_WEB_AUTH + "." + webAuthName + ".password");
Credentials credentials;
if (Constants.NTLM.equals(scheme)) {
final String workstation = paramMap.get(CRAWLER_WEB_AUTH + "." + webAuthName + ".workstation");
final String domain = paramMap.get(CRAWLER_WEB_AUTH + "." + webAuthName + ".domain");
credentials = new NTCredentials(username, password == null ? StringUtil.EMPTY : password, workstation == null ? StringUtil.EMPTY : workstation, domain == null ? StringUtil.EMPTY : domain);
} else {
credentials = new UsernamePasswordCredentials(username, password == null ? StringUtil.EMPTY : password);
}
return credentials;
}
Aggregations